{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/22317","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/22317/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/22317/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/22317/events","html_url":"https://github.com/facebook/react-native/pull/22317","id":381711965,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxNjE3OTcw","number":22317,"title":"Fix of the memory leaks in catalyst. ","user":{"login":"dryganets","id":54233,"node_id":"MDQ6VXNlcjU0MjMz","avatar_url":"https://avatars0.githubusercontent.com/u/54233?v=4","gravatar_id":"","url":"https://api.github.com/users/dryganets","html_url":"https://github.com/dryganets","followers_url":"https://api.github.com/users/dryganets/followers","following_url":"https://api.github.com/users/dryganets/following{/other_user}","gists_url":"https://api.github.com/users/dryganets/gists{/gist_id}","starred_url":"https://api.github.com/users/dryganets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dryganets/subscriptions","organizations_url":"https://api.github.com/users/dryganets/orgs","repos_url":"https://api.github.com/users/dryganets/repos","events_url":"https://api.github.com/users/dryganets/events{/privacy}","received_events_url":"https://api.github.com/users/dryganets/received_events","type":"User","site_admin":false},"labels":[{"id":196858975,"node_id":"MDU6TGFiZWwxOTY4NTg5NzU=","url":"https://api.github.com/repos/facebook/react-native/labels/CLA%20Signed","name":"CLA Signed","color":"ffffff","default":false},{"id":468774151,"node_id":"MDU6TGFiZWw0Njg3NzQxNTE=","url":"https://api.github.com/repos/facebook/react-native/labels/Core%20Team","name":"Core Team","color":"0052cc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-16T18:30:32Z","updated_at":"2018-11-30T19:55:18Z","closed_at":"2018-11-30T19:55:18Z","author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/22317","html_url":"https://github.com/facebook/react-native/pull/22317","diff_url":"https://github.com/facebook/react-native/pull/22317.diff","patch_url":"https://github.com/facebook/react-native/pull/22317.patch"},"body":"ReactApplicationContext holds a reference to the CatalystInstanceImpl which holds references to the NativeModules. Many native modules store the references to objects holding the references to the Activity holders. The examples of such modules are UIManagerModule, NativeAnimatedModule and many others.\r\n\r\nAs result without this change caching the ReactApplicationContext causes Activity leaks. It is counter-intuitive.\r\n\r\nTest Plan:\r\n----------\r\nTest with LeakCannery for memory leaks on JSEngine re-creation\r\n\r\nChangelog:\r\n----------\r\n[Android] [Fixed] - ReactAppliclationContext leaks activity.\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/443320814","html_url":"https://github.com/facebook/react-native/pull/22317#issuecomment-443320814","issue_url":"https://api.github.com/repos/facebook/react-native/issues/22317","id":443320814,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzMyMDgxNA==","user":{"login":"dryganets","id":54233,"node_id":"MDQ6VXNlcjU0MjMz","avatar_url":"https://avatars0.githubusercontent.com/u/54233?v=4","gravatar_id":"","url":"https://api.github.com/users/dryganets","html_url":"https://github.com/dryganets","followers_url":"https://api.github.com/users/dryganets/followers","following_url":"https://api.github.com/users/dryganets/following{/other_user}","gists_url":"https://api.github.com/users/dryganets/gists{/gist_id}","starred_url":"https://api.github.com/users/dryganets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dryganets/subscriptions","organizations_url":"https://api.github.com/users/dryganets/orgs","repos_url":"https://api.github.com/users/dryganets/repos","events_url":"https://api.github.com/users/dryganets/events{/privacy}","received_events_url":"https://api.github.com/users/dryganets/received_events","type":"User","site_admin":false},"created_at":"2018-11-30T19:55:17Z","updated_at":"2018-11-30T19:55:17Z","author_association":"COLLABORATOR","body":"We found problems related to this commit in production. Not really high rate, but still.\r\n\r\nThere is no protection for getModule calls and in some cases, it is used in the async context. For example network requests sending events by  calling\r\n```\r\nreactContext.getNativeModule(UIManagerModule.class)\r\n      .getEventDispatcher()\r\n```\r\nThe module might not exist if JSEngine is already destroyed and we have a cleanup in place.\r\n\r\nWe got to fix a root cause - sanitize the ReactApplicationContext usage as it leaks the JSEngine if cached.\r\n"}}
{"actor":{"display_login":"dryganets"}}