{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/firefox-ios/issues/1100","labels_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/1100/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/1100/comments","events_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/1100/events","html_url":"https://github.com/mozilla/firefox-ios/pull/1100","id":107993670,"number":1100,"title":"Bug 1206944 - Startup crash due to database contention","user":{"login":"rnewman","id":91722,"avatar_url":"https://avatars.githubusercontent.com/u/91722?v=3","gravatar_id":"","url":"https://api.github.com/users/rnewman","html_url":"https://github.com/rnewman","followers_url":"https://api.github.com/users/rnewman/followers","following_url":"https://api.github.com/users/rnewman/following{/other_user}","gists_url":"https://api.github.com/users/rnewman/gists{/gist_id}","starred_url":"https://api.github.com/users/rnewman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rnewman/subscriptions","organizations_url":"https://api.github.com/users/rnewman/orgs","repos_url":"https://api.github.com/users/rnewman/repos","events_url":"https://api.github.com/users/rnewman/events{/privacy}","received_events_url":"https://api.github.com/users/rnewman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mozilla/firefox-ios/labels/needs%20review","name":"needs review","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"rnewman","id":91722,"avatar_url":"https://avatars.githubusercontent.com/u/91722?v=3","gravatar_id":"","url":"https://api.github.com/users/rnewman","html_url":"https://github.com/rnewman","followers_url":"https://api.github.com/users/rnewman/followers","following_url":"https://api.github.com/users/rnewman/following{/other_user}","gists_url":"https://api.github.com/users/rnewman/gists{/gist_id}","starred_url":"https://api.github.com/users/rnewman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rnewman/subscriptions","organizations_url":"https://api.github.com/users/rnewman/orgs","repos_url":"https://api.github.com/users/rnewman/repos","events_url":"https://api.github.com/users/rnewman/events{/privacy}","received_events_url":"https://api.github.com/users/rnewman/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/mozilla/firefox-ios/milestones/1","html_url":"https://github.com/mozilla/firefox-ios/milestones/Firefox%20iOS%201.1","labels_url":"https://api.github.com/repos/mozilla/firefox-ios/milestones/1/labels","id":1233828,"number":1,"title":"Firefox iOS 1.1","description":"","creator":{"login":"wesj","id":1117644,"avatar_url":"https://avatars.githubusercontent.com/u/1117644?v=3","gravatar_id":"","url":"https://api.github.com/users/wesj","html_url":"https://github.com/wesj","followers_url":"https://api.github.com/users/wesj/followers","following_url":"https://api.github.com/users/wesj/following{/other_user}","gists_url":"https://api.github.com/users/wesj/gists{/gist_id}","starred_url":"https://api.github.com/users/wesj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wesj/subscriptions","organizations_url":"https://api.github.com/users/wesj/orgs","repos_url":"https://api.github.com/users/wesj/repos","events_url":"https://api.github.com/users/wesj/events{/privacy}","received_events_url":"https://api.github.com/users/wesj/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":15,"state":"open","created_at":"2015-07-30T17:02:12Z","updated_at":"2015-09-23T19:53:54Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-09-23T19:53:54Z","updated_at":"2015-09-24T21:25:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/1100","html_url":"https://github.com/mozilla/firefox-ios/pull/1100","diff_url":"https://github.com/mozilla/firefox-ios/pull/1100.diff","patch_url":"https://github.com/mozilla/firefox-ios/pull/1100.patch"},"body":"There were two problems here.\r\n\r\nThe first is that we were loading queued tabs in the background while the main thread was initing `SearchLoader` with `profile.history`, which caused DB init. (The root cause is that table init is a special snowflake.)\r\n\r\nThe fix for that is to… not do that. `SearchLoader` can access `profile.history` when it needs it, on the correct thread.\r\n\r\nThe second is that we were loading queued tabs twice, once in `BVC` when our view loads, and once in `AppDelegate` when we become active. These occur on separate threads and can thus content.\r\n\r\nThe fix for that is to remove one. I opted to keep the `AppDelegate` one, which is where we first put it. I tested both app switching and changing apps via the launchpad, and we still correctly dequeue tabs.\r\n\r\nHandily, both of these changes should slightly improve our startup performance."},"comment":{"url":"https://api.github.com/repos/mozilla/firefox-ios/issues/comments/143055029","html_url":"https://github.com/mozilla/firefox-ios/pull/1100#issuecomment-143055029","issue_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/1100","id":143055029,"user":{"login":"rnewman","id":91722,"avatar_url":"https://avatars.githubusercontent.com/u/91722?v=3","gravatar_id":"","url":"https://api.github.com/users/rnewman","html_url":"https://github.com/rnewman","followers_url":"https://api.github.com/users/rnewman/followers","following_url":"https://api.github.com/users/rnewman/following{/other_user}","gists_url":"https://api.github.com/users/rnewman/gists{/gist_id}","starred_url":"https://api.github.com/users/rnewman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rnewman/subscriptions","organizations_url":"https://api.github.com/users/rnewman/orgs","repos_url":"https://api.github.com/users/rnewman/repos","events_url":"https://api.github.com/users/rnewman/events{/privacy}","received_events_url":"https://api.github.com/users/rnewman/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T21:25:37Z","updated_at":"2015-09-24T21:25:37Z","body":"Good idea. I made that change in c7a1b66. It's not immediately enough to simplify things, because there would still be a capture of a `self`, but we can revisit this. (I don't want to rejig things again right now in case I break something else!)"}}