{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/61855427","id":61855427,"diff_hunk":"@@ -90,11 +101,23 @@ class ThrowExceptionStrategyPersistentActorBoundedStashingSpec\n \n       //internal stash overflow\n       1 to (2 * capacity) foreach (persistentActor ! Cmd(_))\n-      //after PA stopped, all stashed messages forward to deadletters\n-      1 to capacity foreach (i ⇒ expectMsg(DeadLetter(Cmd(i), testActor, persistentActor)))\n-      //non-stashed messages\n-      (capacity + 2) to (2 * capacity) foreach (i ⇒ expectMsg(DeadLetter(Cmd(i), testActor, persistentActor)))\n \n+      //after PA stopped, all stashed messages forward to deadletters\n+      //the message triggering the overflow is lost, so we get one less message than we sent\n+      val messages: Seq[DeadLetter] = 1 until (2 * capacity) map { _ ⇒ expectMsgType[DeadLetter] }\n+\n+      //if the mailbox of the PA happens to close before we manage to send all messages, then those\n+      //messages can get sent to dead letters before or mixed with the stashed ones so we need to partition them\n+      val (stashed, nonStashed) = messages.partition {\n+        case DeadLetter(Cmd(i: Int), `testActor`, `persistentActor`) ⇒ i <= capacity\n+      }\n+\n+      checkMessagesAreInOrder(stashed, 1)\n+      //since we don't know exactly which message is the last one going into the mailbox and which one is the\n+      //first one going directly to dead letters, we can't assume an ordering and need to sort the messages\n+      checkMessagesAreInOrder(nonStashed.sortBy {\n+        case DeadLetter(Cmd(i: Int), _, _) ⇒ i\n+      }, capacity + 2)","path":"akka-persistence/src/test/scala/akka/persistence/PersistentActorBoundedStashingSpec.scala","position":52,"original_position":52,"commit_id":"c090879f038f3f1cf0e61041ff3106b4d04a60be","original_commit_id":"c090879f038f3f1cf0e61041ff3106b4d04a60be","user":{"login":"bantonsson","id":805830,"avatar_url":"https://avatars.githubusercontent.com/u/805830?v=3","gravatar_id":"","url":"https://api.github.com/users/bantonsson","html_url":"https://github.com/bantonsson","followers_url":"https://api.github.com/users/bantonsson/followers","following_url":"https://api.github.com/users/bantonsson/following{/other_user}","gists_url":"https://api.github.com/users/bantonsson/gists{/gist_id}","starred_url":"https://api.github.com/users/bantonsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bantonsson/subscriptions","organizations_url":"https://api.github.com/users/bantonsson/orgs","repos_url":"https://api.github.com/users/bantonsson/repos","events_url":"https://api.github.com/users/bantonsson/events{/privacy}","received_events_url":"https://api.github.com/users/bantonsson/received_events","type":"User","site_admin":false},"body":"@patriknw Could you elaborate on when the message may be lost? Are we talking about the very small window between `actor.swapMailbox` and `mailBox.becomeClosed` in `unregister`, or is there something else? And no, it assumes that part works fine.","created_at":"2016-05-03T09:14:16Z","updated_at":"2016-05-03T09:14:16Z","html_url":"https://github.com/akka/akka/pull/20432#discussion_r61855427","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/20432","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/61855427"},"html":{"href":"https://github.com/akka/akka/pull/20432#discussion_r61855427"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/20432"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/20432","id":68532312,"html_url":"https://github.com/akka/akka/pull/20432","diff_url":"https://github.com/akka/akka/pull/20432.diff","patch_url":"https://github.com/akka/akka/pull/20432.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/20432","number":20432,"state":"open","locked":false,"title":"=per Fix flaky ThrowExceptionStrategyPersistentActorBoundedStashingSpec","user":{"login":"bantonsson","id":805830,"avatar_url":"https://avatars.githubusercontent.com/u/805830?v=3","gravatar_id":"","url":"https://api.github.com/users/bantonsson","html_url":"https://github.com/bantonsson","followers_url":"https://api.github.com/users/bantonsson/followers","following_url":"https://api.github.com/users/bantonsson/following{/other_user}","gists_url":"https://api.github.com/users/bantonsson/gists{/gist_id}","starred_url":"https://api.github.com/users/bantonsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bantonsson/subscriptions","organizations_url":"https://api.github.com/users/bantonsson/orgs","repos_url":"https://api.github.com/users/bantonsson/repos","events_url":"https://api.github.com/users/bantonsson/events{/privacy}","received_events_url":"https://api.github.com/users/bantonsson/received_events","type":"User","site_admin":false},"body":"This test triggered intermittent failures in some internal builds. It had a small race that sometime manifested on the slow EC2 nodes running it.\r\n\r\nCould easily trigger the behaviour by adding some sleeps in message sending and mailbox cleanup.","created_at":"2016-05-02T07:59:19Z","updated_at":"2016-05-03T09:14:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"22ed0b34f185a7b7d20a681f867a20b807bc806e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/20432/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/20432/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka/issues/20432/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/c090879f038f3f1cf0e61041ff3106b4d04a60be","head":{"label":"bantonsson:wip-ban-fix-flaky-persistence-test","ref":"wip-ban-fix-flaky-persistence-test","sha":"c090879f038f3f1cf0e61041ff3106b4d04a60be","user":{"login":"bantonsson","id":805830,"avatar_url":"https://avatars.githubusercontent.com/u/805830?v=3","gravatar_id":"","url":"https://api.github.com/users/bantonsson","html_url":"https://github.com/bantonsson","followers_url":"https://api.github.com/users/bantonsson/followers","following_url":"https://api.github.com/users/bantonsson/following{/other_user}","gists_url":"https://api.github.com/users/bantonsson/gists{/gist_id}","starred_url":"https://api.github.com/users/bantonsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bantonsson/subscriptions","organizations_url":"https://api.github.com/users/bantonsson/orgs","repos_url":"https://api.github.com/users/bantonsson/repos","events_url":"https://api.github.com/users/bantonsson/events{/privacy}","received_events_url":"https://api.github.com/users/bantonsson/received_events","type":"User","site_admin":false},"repo":{"id":31009670,"name":"akka","full_name":"bantonsson/akka","owner":{"login":"bantonsson","id":805830,"avatar_url":"https://avatars.githubusercontent.com/u/805830?v=3","gravatar_id":"","url":"https://api.github.com/users/bantonsson","html_url":"https://github.com/bantonsson","followers_url":"https://api.github.com/users/bantonsson/followers","following_url":"https://api.github.com/users/bantonsson/following{/other_user}","gists_url":"https://api.github.com/users/bantonsson/gists{/gist_id}","starred_url":"https://api.github.com/users/bantonsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bantonsson/subscriptions","organizations_url":"https://api.github.com/users/bantonsson/orgs","repos_url":"https://api.github.com/users/bantonsson/repos","events_url":"https://api.github.com/users/bantonsson/events{/privacy}","received_events_url":"https://api.github.com/users/bantonsson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bantonsson/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/bantonsson/akka","forks_url":"https://api.github.com/repos/bantonsson/akka/forks","keys_url":"https://api.github.com/repos/bantonsson/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bantonsson/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bantonsson/akka/teams","hooks_url":"https://api.github.com/repos/bantonsson/akka/hooks","issue_events_url":"https://api.github.com/repos/bantonsson/akka/issues/events{/number}","events_url":"https://api.github.com/repos/bantonsson/akka/events","assignees_url":"https://api.github.com/repos/bantonsson/akka/assignees{/user}","branches_url":"https://api.github.com/repos/bantonsson/akka/branches{/branch}","tags_url":"https://api.github.com/repos/bantonsson/akka/tags","blobs_url":"https://api.github.com/repos/bantonsson/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bantonsson/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bantonsson/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/bantonsson/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bantonsson/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/bantonsson/akka/languages","stargazers_url":"https://api.github.com/repos/bantonsson/akka/stargazers","contributors_url":"https://api.github.com/repos/bantonsson/akka/contributors","subscribers_url":"https://api.github.com/repos/bantonsson/akka/subscribers","subscription_url":"https://api.github.com/repos/bantonsson/akka/subscription","commits_url":"https://api.github.com/repos/bantonsson/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/bantonsson/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/bantonsson/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/bantonsson/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/bantonsson/akka/contents/{+path}","compare_url":"https://api.github.com/repos/bantonsson/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bantonsson/akka/merges","archive_url":"https://api.github.com/repos/bantonsson/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bantonsson/akka/downloads","issues_url":"https://api.github.com/repos/bantonsson/akka/issues{/number}","pulls_url":"https://api.github.com/repos/bantonsson/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/bantonsson/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/bantonsson/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bantonsson/akka/labels{/name}","releases_url":"https://api.github.com/repos/bantonsson/akka/releases{/id}","deployments_url":"https://api.github.com/repos/bantonsson/akka/deployments","created_at":"2015-02-19T10:05:12Z","updated_at":"2016-04-29T11:34:23Z","pushed_at":"2016-05-02T07:56:35Z","git_url":"git://github.com/bantonsson/akka.git","ssh_url":"git@github.com:bantonsson/akka.git","clone_url":"https://github.com/bantonsson/akka.git","svn_url":"https://github.com/bantonsson/akka","homepage":"http://akka.io","size":189966,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"akka:master","ref":"master","sha":"8d7d3aac6b1a7d994d8352f7906687c6843e46ae","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"name":"akka","full_name":"akka/akka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka","description":"Akka Project","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka/deployments","created_at":"2009-02-16T12:51:54Z","updated_at":"2016-05-02T12:37:17Z","pushed_at":"2016-05-03T08:11:49Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":237174,"stargazers_count":5452,"watchers_count":5452,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1696,"mirror_url":null,"open_issues_count":717,"forks":1696,"open_issues":717,"watchers":5452,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/20432"},"html":{"href":"https://github.com/akka/akka/pull/20432"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/20432"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/20432/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/20432/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/20432/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/c090879f038f3f1cf0e61041ff3106b4d04a60be"}}}}