Skip to content

src: fix crash on FSReqPromise destructor

We are deciding whether to end fs promises by checking can_call_into_js() whereas in the FSReqPromise destructor we're using the is_stopping() check. Though this may look as semantically correct it has issues because though both values are modified before termination on Environment::ExitEnv() and both are atomic they are not synchronized together so it may happen that when reaching the destructor call_into_js may be set to false whereas is_stopping remains false causing the crash. Fix this by using the same checks everywhere.

Fixes: https://github.com/nodejs/node/issues/43499

Merge request reports

Loading