Skip to content

Commit 43cad78

Browse files
santigimenoruyadorno
authored andcommittedJan 31, 2023
src: stop tracing agent before shutting down libuv
Otherwise there might be pending tracing fs writes which lead to a crash because the libuv threadpool is already gone. Fixes: #46376 PR-URL: #46380 Reviewed-By: theanarkh <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent d13116a commit 43cad78

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎src/api/environment.cc

+4
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,10 @@ void DefaultProcessExitHandlerInternal(Environment* env, ExitCode exit_code) {
798798
env->set_can_call_into_js(false);
799799
env->stop_sub_worker_contexts();
800800
env->isolate()->DumpAndResetStats();
801+
// The tracing agent could be in the process of writing data using the
802+
// threadpool. Stop it before shutting down libuv. The rest of the tracing
803+
// agent disposal will be performed in DisposePlatform().
804+
per_process::v8_platform.StopTracingAgent();
801805
// When the process exits, the tasks in the thread pool may also need to
802806
// access the data of V8Platform, such as trace agent, or a field
803807
// added in the future. So make sure the thread pool exits first.

0 commit comments

Comments
 (0)
Please sign in to comment.