Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantiago Gimeno <santiago.gimeno@gmail.com>2022-06-18 12:20:40 +0300
committerGitHub <noreply@github.com>2022-06-18 12:20:40 +0300
commit4c077b07bc325af4fb2b89470f15172112c87018 (patch)
treee7da08b53627b4178827e5cf85d27135d3857381 /src/node_file-inl.h
parent61c7103ed06e5364eddae4586f90ee97531e14a6 (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.h6
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>