mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
src: fix race on process exit and off thread CA loading
When calling `process.exit()` or on uncaught exceptions as soon as the process starts, the process will try to terminate immediately. In this case, there could be a race condition on the unfinished off-thread system CA loader which tries to access the OpenSSL API which has been de-inited on the main thread. PR-URL: https://github.com/nodejs/node/pull/59632 Refs: https://github.com/nodejs/node/pull/59550 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
#include <cstdlib>
|
||||
#if HAVE_OPENSSL
|
||||
#include "crypto/crypto_util.h"
|
||||
#endif // HAVE_OPENSSL
|
||||
#include "env_properties.h"
|
||||
#include "node.h"
|
||||
#include "node_builtins.h"
|
||||
@@ -1004,6 +1007,11 @@ void DefaultProcessExitHandlerInternal(Environment* env, ExitCode exit_code) {
|
||||
// in node_v8_platform-inl.h
|
||||
uv_library_shutdown();
|
||||
DisposePlatform();
|
||||
|
||||
#if HAVE_OPENSSL
|
||||
crypto::CleanupCachedRootCertificates();
|
||||
#endif // HAVE_OPENSSL
|
||||
|
||||
Exit(exit_code);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user