{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-js/issues/1394","repository_url":"https://api.github.com/repos/realm/realm-js","labels_url":"https://api.github.com/repos/realm/realm-js/issues/1394/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-js/issues/1394/comments","events_url":"https://api.github.com/repos/realm/realm-js/issues/1394/events","html_url":"https://github.com/realm/realm-js/pull/1394","id":263841937,"number":1394,"title":"Bug fixes (#1391, #1392, #1393).","user":{"login":"kneth","id":1225363,"avatar_url":"https://avatars0.githubusercontent.com/u/1225363?v=4","gravatar_id":"","url":"https://api.github.com/users/kneth","html_url":"https://github.com/kneth","followers_url":"https://api.github.com/users/kneth/followers","following_url":"https://api.github.com/users/kneth/following{/other_user}","gists_url":"https://api.github.com/users/kneth/gists{/gist_id}","starred_url":"https://api.github.com/users/kneth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kneth/subscriptions","organizations_url":"https://api.github.com/users/kneth/orgs","repos_url":"https://api.github.com/users/kneth/repos","events_url":"https://api.github.com/users/kneth/events{/privacy}","received_events_url":"https://api.github.com/users/kneth/received_events","type":"User","site_admin":false},"labels":[{"id":247475509,"url":"https://api.github.com/repos/realm/realm-js/labels/T:Bug","name":"T:Bug","color":"eb6420","default":false}],"state":"open","locked":false,"assignee":{"login":"kneth","id":1225363,"avatar_url":"https://avatars0.githubusercontent.com/u/1225363?v=4","gravatar_id":"","url":"https://api.github.com/users/kneth","html_url":"https://github.com/kneth","followers_url":"https://api.github.com/users/kneth/followers","following_url":"https://api.github.com/users/kneth/following{/other_user}","gists_url":"https://api.github.com/users/kneth/gists{/gist_id}","starred_url":"https://api.github.com/users/kneth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kneth/subscriptions","organizations_url":"https://api.github.com/users/kneth/orgs","repos_url":"https://api.github.com/users/kneth/repos","events_url":"https://api.github.com/users/kneth/events{/privacy}","received_events_url":"https://api.github.com/users/kneth/received_events","type":"User","site_admin":false},"assignees":[{"login":"kneth","id":1225363,"avatar_url":"https://avatars0.githubusercontent.com/u/1225363?v=4","gravatar_id":"","url":"https://api.github.com/users/kneth","html_url":"https://github.com/kneth","followers_url":"https://api.github.com/users/kneth/followers","following_url":"https://api.github.com/users/kneth/following{/other_user}","gists_url":"https://api.github.com/users/kneth/gists{/gist_id}","starred_url":"https://api.github.com/users/kneth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kneth/subscriptions","organizations_url":"https://api.github.com/users/kneth/orgs","repos_url":"https://api.github.com/users/kneth/repos","events_url":"https://api.github.com/users/kneth/events{/privacy}","received_events_url":"https://api.github.com/users/kneth/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2017-10-09T10:04:34Z","updated_at":"2017-10-10T01:17:46Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/realm/realm-js/pulls/1394","html_url":"https://github.com/realm/realm-js/pull/1394","diff_url":"https://github.com/realm/realm-js/pull/1394.diff","patch_url":"https://github.com/realm/realm-js/pull/1394.patch"},"body":"<!-- Make sure to assign one and only one Type (`T:`) and State (`S:`) label.\r\n Select reviewers if ready for review. Our bot will automatically assign you. -->\r\n\r\n## What, How & Why?\r\n<!-- Describe the changes and give some hints to guide your reviewers if possible. -->\r\n<!-- E.g. reference to other repos: This closes realm/realm-sync#??? -->\r\n\r\n`Realm._waitForDownload()` has a few issues:\r\n\r\n* `config.path` is not carried over\r\n* the Realm is closed too soon (which opens a new instance instantly)\r\n\r\nThis closes #1391, #1392, #1393 \r\n\r\n## ☑️ ToDos\r\n<!-- Add your own todos here -->\r\n* [x] 📝 Changelog entry\r\n* [x] 🚦 Tests\r\n* [x] 📝 Public documentation PR created or is not necessary\r\n* [x] 💥 `Breaking` label has been applied or is not necessary\r\n\r\n*If this PR adds or changes public API's:*\r\n* [x] typescript definitions file is updated\r\n* [x] jsdoc files updated\r\n* [x] Chrome debug API is updated if API is available on React Native\r\n"},"comment":{"url":"https://api.github.com/repos/realm/realm-js/issues/comments/335331544","html_url":"https://github.com/realm/realm-js/pull/1394#issuecomment-335331544","issue_url":"https://api.github.com/repos/realm/realm-js/issues/1394","id":335331544,"user":{"login":"bdash","id":54825,"avatar_url":"https://avatars3.githubusercontent.com/u/54825?v=4","gravatar_id":"","url":"https://api.github.com/users/bdash","html_url":"https://github.com/bdash","followers_url":"https://api.github.com/users/bdash/followers","following_url":"https://api.github.com/users/bdash/following{/other_user}","gists_url":"https://api.github.com/users/bdash/gists{/gist_id}","starred_url":"https://api.github.com/users/bdash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdash/subscriptions","organizations_url":"https://api.github.com/users/bdash/orgs","repos_url":"https://api.github.com/users/bdash/repos","events_url":"https://api.github.com/users/bdash/events{/privacy}","received_events_url":"https://api.github.com/users/bdash/received_events","type":"User","site_admin":false},"created_at":"2017-10-10T01:17:46Z","updated_at":"2017-10-10T01:17:46Z","author_association":"CONTRIBUTOR","body":"There's a further issue with the sync session lifetime. The download completion block for `SyncSession::wait_for_download_completion` is executed on the sync client worker thread. It then uses Realm JS's `EventLoopDispatcher` mechanism to execute the JavaScript callback on the JS event loop. This means that the call to `Realm::close` that is performed immediately after `waitFunc` is called can close the Realm, and thus the sync session, before the main thread has a chance to open it within the JS callback.\r\n\r\nThe simplest way to address this seems like it would be moving the call to `Realm::close` into the `wait_handler` lambda, after the JS callback has been executed. This guarantees that the JS callback has an opportunity to establish a new reference to the sync session (by opening its own `Realm` instance) before we drop our reference to it (by closing our `Realm`)."}}
{"actor":{"display_login":"bdash"}}