Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 42db849

Browse filesBrowse files
theanarkhRafaelGSS
authored andcommitted
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 #44458 PR-URL: #45226 Refs: #44458 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
1 parent b41b5ba commit 42db849
Copy full SHA for 42db849

File tree

Expand file treeCollapse file tree

2 files changed

+8
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-2
lines changed
Open diff view settings
Collapse file

‎src/api/environment.cc‎

Copy file name to clipboardExpand all lines: src/api/environment.cc
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,13 @@ void DefaultProcessExitHandlerInternal(Environment* env, ExitCode exit_code) {
773773
env->set_can_call_into_js(false);
774774
env->stop_sub_worker_contexts();
775775
env->isolate()->DumpAndResetStats();
776-
DisposePlatform();
776+
// When the process exits, the tasks in the thread pool may also need to
777+
// access the data of V8Platform, such as trace agent, or a field
778+
// added in the future. So make sure the thread pool exits first.
779+
// And make sure V8Platform don not call into Libuv threadpool, see Dispose
780+
// in node_v8_platform-inl.h
777781
uv_library_shutdown();
782+
DisposePlatform();
778783
Exit(exit_code);
779784
}
780785

Collapse file

‎src/node_v8_platform-inl.h‎

Copy file name to clipboardExpand all lines: src/node_v8_platform-inl.h
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ struct V8Platform {
103103
platform_ = new NodePlatform(thread_pool_size, controller);
104104
v8::V8::InitializePlatform(platform_);
105105
}
106-
106+
// Make sure V8Platform don not call into Libuv threadpool,
107+
// see DefaultProcessExitHandlerInternal in environment.cc
107108
inline void Dispose() {
108109
if (!initialized_)
109110
return;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.