{"action":"opened","number":510,"pull_request":{"url":"https://api.github.com/repos/firebase/firebase-ios-sdk/pulls/510","id":155495497,"html_url":"https://github.com/firebase/firebase-ios-sdk/pull/510","diff_url":"https://github.com/firebase/firebase-ios-sdk/pull/510.diff","patch_url":"https://github.com/firebase/firebase-ios-sdk/pull/510.patch","issue_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/issues/510","number":510,"state":"open","locked":false,"title":"Mrschmidt crash","user":{"login":"schmidt-sebastian","id":19397744,"avatar_url":"https://avatars3.githubusercontent.com/u/19397744?v=4","gravatar_id":"","url":"https://api.github.com/users/schmidt-sebastian","html_url":"https://github.com/schmidt-sebastian","followers_url":"https://api.github.com/users/schmidt-sebastian/followers","following_url":"https://api.github.com/users/schmidt-sebastian/following{/other_user}","gists_url":"https://api.github.com/users/schmidt-sebastian/gists{/gist_id}","starred_url":"https://api.github.com/users/schmidt-sebastian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schmidt-sebastian/subscriptions","organizations_url":"https://api.github.com/users/schmidt-sebastian/orgs","repos_url":"https://api.github.com/users/schmidt-sebastian/repos","events_url":"https://api.github.com/users/schmidt-sebastian/events{/privacy}","received_events_url":"https://api.github.com/users/schmidt-sebastian/received_events","type":"User","site_admin":false},"body":"This should address https://b.corp.google.com/issues/69701162\r\n\r\nThere are two issues that this PR addresses:\r\n\r\n* The one I found during local testing is that we call `notifyStreamInterruptedWithError` in FSTStream before we clear the stream delegate. It is then possible that FSTRemoteStore re-opens the write stream right away (synchronously). The assert in `startWithDelegate` that verifies that no delegate is set triggers in this case.\r\n\r\n* The other one was root-caused by banging my head on the keyboard a couple times. I believe that it is possible to corrupt the stream state if the idle callback gets schedule while other operations are active. The following sequence should trigger this:\r\n\r\n- Stream goes idle, we schedule the idle callback for execution in 60s\r\n- 59.9 seconds later, the backend closes the stream for whatever reason. `writeStreamFinished` is invoked and schedules`handleStreamClose` on the dispatch queue.\r\n- The idle callback triggers and sets the stream state to `Initial`\r\n- `handleStreamClose` runs and asserts since the stream is no longer active.\r\n\r\nI tried to find docs (or sources) for Apple's dispatch queue to verify how events are queued. I was hoping that the guarantees where similar to JS: `setImmediate()` always get priority over `setTimeout()`. This is however not the case - using a small test app I was able to verify that iOS does not prioritize existing `dispatch_async` over `dispatch_after(now)`.\r\n\r\n\r\n\r\nFixes: https://www.google.com/url?q=https://github.com/firebase/firebase-ios-sdk/issues/490","created_at":"2017-11-30T01:17:08Z","updated_at":"2017-11-30T01:17:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/pulls/510/commits","review_comments_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/pulls/510/comments","review_comment_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/issues/510/comments","statuses_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/statuses/c8afeb2c17b142d309b252bb152d9a7e7ea0aab2","head":{"label":"firebase:mrschmidt-crash","ref":"mrschmidt-crash","sha":"c8afeb2c17b142d309b252bb152d9a7e7ea0aab2","user":{"login":"firebase","id":1335026,"avatar_url":"https://avatars2.githubusercontent.com/u/1335026?v=4","gravatar_id":"","url":"https://api.github.com/users/firebase","html_url":"https://github.com/firebase","followers_url":"https://api.github.com/users/firebase/followers","following_url":"https://api.github.com/users/firebase/following{/other_user}","gists_url":"https://api.github.com/users/firebase/gists{/gist_id}","starred_url":"https://api.github.com/users/firebase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firebase/subscriptions","organizations_url":"https://api.github.com/users/firebase/orgs","repos_url":"https://api.github.com/users/firebase/repos","events_url":"https://api.github.com/users/firebase/events{/privacy}","received_events_url":"https://api.github.com/users/firebase/received_events","type":"Organization","site_admin":false},"repo":{"id":89033556,"name":"firebase-ios-sdk","full_name":"firebase/firebase-ios-sdk","owner":{"login":"firebase","id":1335026,"avatar_url":"https://avatars2.githubusercontent.com/u/1335026?v=4","gravatar_id":"","url":"https://api.github.com/users/firebase","html_url":"https://github.com/firebase","followers_url":"https://api.github.com/users/firebase/followers","following_url":"https://api.github.com/users/firebase/following{/other_user}","gists_url":"https://api.github.com/users/firebase/gists{/gist_id}","starred_url":"https://api.github.com/users/firebase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firebase/subscriptions","organizations_url":"https://api.github.com/users/firebase/orgs","repos_url":"https://api.github.com/users/firebase/repos","events_url":"https://api.github.com/users/firebase/events{/privacy}","received_events_url":"https://api.github.com/users/firebase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/firebase/firebase-ios-sdk","description":"Firebase iOS SDK","fork":false,"url":"https://api.github.com/repos/firebase/firebase-ios-sdk","forks_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/forks","keys_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/teams","hooks_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/hooks","issue_events_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/events","assignees_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/tags","blobs_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/languages","stargazers_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/stargazers","contributors_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/contributors","subscribers_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/subscribers","subscription_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/subscription","commits_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/merges","archive_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/downloads","issues_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/labels{/name}","releases_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/deployments","created_at":"2017-04-22T00:26:50Z","updated_at":"2017-11-28T13:26:12Z","pushed_at":"2017-11-30T01:02:52Z","git_url":"git://github.com/firebase/firebase-ios-sdk.git","ssh_url":"git@github.com:firebase/firebase-ios-sdk.git","clone_url":"https://github.com/firebase/firebase-ios-sdk.git","svn_url":"https://github.com/firebase/firebase-ios-sdk","homepage":"https://firebase.google.com","size":3441,"stargazers_count":469,"watchers_count":469,"language":"Objective-C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":80,"mirror_url":null,"archived":false,"open_issues_count":62,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":80,"open_issues":62,"watchers":469,"default_branch":"master"}},"base":{"label":"firebase:master","ref":"master","sha":"123ce4cdea12140a5e6aa75de5627fc1dfc7e787","user":{"login":"firebase","id":1335026,"avatar_url":"https://avatars2.githubusercontent.com/u/1335026?v=4","gravatar_id":"","url":"https://api.github.com/users/firebase","html_url":"https://github.com/firebase","followers_url":"https://api.github.com/users/firebase/followers","following_url":"https://api.github.com/users/firebase/following{/other_user}","gists_url":"https://api.github.com/users/firebase/gists{/gist_id}","starred_url":"https://api.github.com/users/firebase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firebase/subscriptions","organizations_url":"https://api.github.com/users/firebase/orgs","repos_url":"https://api.github.com/users/firebase/repos","events_url":"https://api.github.com/users/firebase/events{/privacy}","received_events_url":"https://api.github.com/users/firebase/received_events","type":"Organization","site_admin":false},"repo":{"id":89033556,"name":"firebase-ios-sdk","full_name":"firebase/firebase-ios-sdk","owner":{"login":"firebase","id":1335026,"avatar_url":"https://avatars2.githubusercontent.com/u/1335026?v=4","gravatar_id":"","url":"https://api.github.com/users/firebase","html_url":"https://github.com/firebase","followers_url":"https://api.github.com/users/firebase/followers","following_url":"https://api.github.com/users/firebase/following{/other_user}","gists_url":"https://api.github.com/users/firebase/gists{/gist_id}","starred_url":"https://api.github.com/users/firebase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firebase/subscriptions","organizations_url":"https://api.github.com/users/firebase/orgs","repos_url":"https://api.github.com/users/firebase/repos","events_url":"https://api.github.com/users/firebase/events{/privacy}","received_events_url":"https://api.github.com/users/firebase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/firebase/firebase-ios-sdk","description":"Firebase iOS SDK","fork":false,"url":"https://api.github.com/repos/firebase/firebase-ios-sdk","forks_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/forks","keys_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/teams","hooks_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/hooks","issue_events_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/events","assignees_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/tags","blobs_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/languages","stargazers_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/stargazers","contributors_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/contributors","subscribers_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/subscribers","subscription_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/subscription","commits_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/merges","archive_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/downloads","issues_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/labels{/name}","releases_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/firebase/firebase-ios-sdk/deployments","created_at":"2017-04-22T00:26:50Z","updated_at":"2017-11-28T13:26:12Z","pushed_at":"2017-11-30T01:02:52Z","git_url":"git://github.com/firebase/firebase-ios-sdk.git","ssh_url":"git@github.com:firebase/firebase-ios-sdk.git","clone_url":"https://github.com/firebase/firebase-ios-sdk.git","svn_url":"https://github.com/firebase/firebase-ios-sdk","homepage":"https://firebase.google.com","size":3441,"stargazers_count":469,"watchers_count":469,"language":"Objective-C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":80,"mirror_url":null,"archived":false,"open_issues_count":62,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":80,"open_issues":62,"watchers":469,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/firebase/firebase-ios-sdk/pulls/510"},"html":{"href":"https://github.com/firebase/firebase-ios-sdk/pull/510"},"issue":{"href":"https://api.github.com/repos/firebase/firebase-ios-sdk/issues/510"},"comments":{"href":"https://api.github.com/repos/firebase/firebase-ios-sdk/issues/510/comments"},"review_comments":{"href":"https://api.github.com/repos/firebase/firebase-ios-sdk/pulls/510/comments"},"review_comment":{"href":"https://api.github.com/repos/firebase/firebase-ios-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/firebase/firebase-ios-sdk/pulls/510/commits"},"statuses":{"href":"https://api.github.com/repos/firebase/firebase-ios-sdk/statuses/c8afeb2c17b142d309b252bb152d9a7e7ea0aab2"}},"author_association":"MEMBER","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":2,"additions":13,"deletions":9,"changed_files":3}}
{"actor":{"display_login":"schmidt-sebastian"}}