diff options
author | Santiago Gimeno <santiago.gimeno@gmail.com> | 2022-06-18 12:20:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-18 12:20:40 +0300 |
commit | 4c077b07bc325af4fb2b89470f15172112c87018 (patch) | |
tree | e7da08b53627b4178827e5cf85d27135d3857381 /src/node_file-inl.h | |
parent | 61c7103ed06e5364eddae4586f90ee97531e14a6 (diff) |
fs: don't end fs promises on Isolate termination
This is specially prevalent in the case of having in-progress FileHandle
operations in a worker thread while the Worker is exiting.
Fixes: https://github.com/nodejs/node/issues/42829
PR-URL: https://github.com/nodejs/node/pull/42910
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Diffstat (limited to 'src/node_file-inl.h')
-rw-r--r-- | src/node_file-inl.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/node_file-inl.h b/src/node_file-inl.h index 0188261b7dc..28d4d9ab8c8 100644 --- a/src/node_file-inl.h +++ b/src/node_file-inl.h @@ -156,8 +156,10 @@ FSReqPromise<AliasedBufferT>::New(BindingData* binding_data, template <typename AliasedBufferT> FSReqPromise<AliasedBufferT>::~FSReqPromise() { - // Validate that the promise was explicitly resolved or rejected. - CHECK(finished_); + // Validate that the promise was explicitly resolved or rejected but only if + // the Isolate is not terminating because in this case the promise might have + // not finished. + if (!env()->is_stopping()) CHECK(finished_); } template <typename AliasedBufferT> |