mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
src: call uv_library_shutdown before DisposePlatform
When the process exits, there may be tasks in the thread pool that need to access data in the platform, such as trace agent. So make sure the thread pool exits first. see https://github.com/nodejs/node/pull/44458 PR-URL: https://github.com/nodejs/node/pull/45226 Refs: https://github.com/nodejs/node/pull/44458 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
This commit is contained in:
committed by
Juan José Arboleda
parent
2364ed7d66
commit
08950fced3
@@ -773,8 +773,13 @@ void DefaultProcessExitHandlerInternal(Environment* env, ExitCode exit_code) {
|
||||
env->set_can_call_into_js(false);
|
||||
env->stop_sub_worker_contexts();
|
||||
env->isolate()->DumpAndResetStats();
|
||||
DisposePlatform();
|
||||
// When the process exits, the tasks in the thread pool may also need to
|
||||
// access the data of V8Platform, such as trace agent, or a field
|
||||
// added in the future. So make sure the thread pool exits first.
|
||||
// And make sure V8Platform don not call into Libuv threadpool, see Dispose
|
||||
// in node_v8_platform-inl.h
|
||||
uv_library_shutdown();
|
||||
DisposePlatform();
|
||||
Exit(exit_code);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,8 @@ struct V8Platform {
|
||||
platform_ = new NodePlatform(thread_pool_size, controller);
|
||||
v8::V8::InitializePlatform(platform_);
|
||||
}
|
||||
|
||||
// Make sure V8Platform don not call into Libuv threadpool,
|
||||
// see DefaultProcessExitHandlerInternal in environment.cc
|
||||
inline void Dispose() {
|
||||
if (!initialized_)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user