{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/11196","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/11196/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/11196/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/11196/events","html_url":"https://github.com/facebook/react-native/issues/11196","id":192385104,"number":11196,"title":"RCTModuleData deadlock when running with debugger","user":{"login":"bruzenak","id":1521805,"avatar_url":"https://avatars3.githubusercontent.com/u/1521805?v=3","gravatar_id":"","url":"https://api.github.com/users/bruzenak","html_url":"https://github.com/bruzenak","followers_url":"https://api.github.com/users/bruzenak/followers","following_url":"https://api.github.com/users/bruzenak/following{/other_user}","gists_url":"https://api.github.com/users/bruzenak/gists{/gist_id}","starred_url":"https://api.github.com/users/bruzenak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruzenak/subscriptions","organizations_url":"https://api.github.com/users/bruzenak/orgs","repos_url":"https://api.github.com/users/bruzenak/repos","events_url":"https://api.github.com/users/bruzenak/events{/privacy}","received_events_url":"https://api.github.com/users/bruzenak/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-11-29T20:04:31Z","updated_at":"2017-03-03T15:06:10Z","closed_at":null,"body":"### Description\r\n\r\nWhen running with the debugger in 0.38, RCTModuleData deadlocks on line 88 of RCTModuleData.mm (std::unique_lock<std::mutex> lock(_instanceLock);). This reproduces reliably with my setup.\r\n\r\nFrom a layman's read, it appears that a module I'm using (react-native-search-bar) is set up to load off the main thread. While it's doing this and grabbing RCTAccessibilityManager, the main thread reloads and tries to grab the lock. Meanwhile RCTAccessibilityManager wants the main thread and already HAS the lock. So it's waiting on dispatch to the main thread, and the main thread is waiting on the accessibility manager to load.\r\n\r\nWithout the debugger, this doesn't lock. It appears the debugger attaches and triggers a reload in [RCTDevMenu setExecutorClass:], and that reload is what's causing this lock.\r\n\r\n### Reproduction\r\n\r\nI attached a package.json file that reproduces this issue.\r\n\r\n1. Run react-native init BugSample\r\n1a. Drop in package.json\r\n1b. Run npm i\r\n2. Open iOS project in XCode\r\n3. Hit run\r\n4. Attach debugger (Cmd+D)\r\n5. Quit\r\n6. Restart\r\n\r\nThis project reliably deadlocks for me.\r\n\r\n[package.json.zip](https://github.com/facebook/react-native/files/620059/package.json.zip)\r\n\r\n### Solution\r\n\r\nDon't grab the locks; wait on the full load process to complete before attaching the debugger, etc. Something this close to core should probably be fixed by an engineer that fully understands the module loading stack.\r\n\r\n### Additional Information\r\n\r\n* React Native version: 0.38.0\r\n* Platform: iOS (only tested on iOS)\r\n* Operating System: MacOS\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/283977627","html_url":"https://github.com/facebook/react-native/issues/11196#issuecomment-283977627","issue_url":"https://api.github.com/repos/facebook/react-native/issues/11196","id":283977627,"user":{"login":"kh1990","id":3402057,"avatar_url":"https://avatars1.githubusercontent.com/u/3402057?v=3","gravatar_id":"","url":"https://api.github.com/users/kh1990","html_url":"https://github.com/kh1990","followers_url":"https://api.github.com/users/kh1990/followers","following_url":"https://api.github.com/users/kh1990/following{/other_user}","gists_url":"https://api.github.com/users/kh1990/gists{/gist_id}","starred_url":"https://api.github.com/users/kh1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kh1990/subscriptions","organizations_url":"https://api.github.com/users/kh1990/orgs","repos_url":"https://api.github.com/users/kh1990/repos","events_url":"https://api.github.com/users/kh1990/events{/privacy}","received_events_url":"https://api.github.com/users/kh1990/received_events","type":"User","site_admin":false},"created_at":"2017-03-03T15:06:10Z","updated_at":"2017-03-03T15:06:10Z","body":"Update: I noticed the deadlock only occurs for me when I am working on a branch. Each time I submit a pull request and merge into the master, the deadlock is resolved. Maybe this will help some of you. "}}
{"actor":{"display_login":"kh1990"}}