facebook / hermes

A JavaScript engine optimized for running React Native.
https://hermesengine.dev/
MIT License
9.41k stars 596 forks source link

Move destruction of RuntimeModule to the mutator #1374

Closed lavenzg closed 4 weeks ago

lavenzg commented 1 month ago

Summary: There is race condition between removing a RuntimeModule from the Runtime in the background thread (triggered from Domain finalizer) and adding a new RuntimeModule in the mutator.

After further investigation, we found that there is also race conditions between Debugger::willUnloadModule() called in the destructor of RuntimeModule and other Debugger actions.

This diff moves the destruction of RuntimeModule (and its removal from the list in Runtime) to the time of marking weak roots in Runtime.

Reviewed By: neildhar

Differential Revision: D56094070

facebook-github-bot commented 1 month ago

This pull request was exported from Phabricator. Differential Revision: D56094070

facebook-github-bot commented 4 weeks ago

This pull request was exported from Phabricator. Differential Revision: D56094070

facebook-github-bot commented 4 weeks ago

This pull request was exported from Phabricator. Differential Revision: D56094070

facebook-github-bot commented 4 weeks ago

This pull request has been merged in facebook/hermes@699138c58e18eb0f6326c1361ae5c3b957afad94.