Skip to content

Commit 2eb2311

Browse files
committed
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
1 parent 3225498 commit 2eb2311

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/api/environment.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,10 @@ void DefaultProcessExitHandlerInternal(Environment* env, ExitCode exit_code) {
791791
env->set_can_call_into_js(false);
792792
env->stop_sub_worker_contexts();
793793
env->isolate()->DumpAndResetStats();
794+
// The tracing agent could be in the process of writing data using the
795+
// threadpool. Stop it before shutting down libuv. The rest of the tracing
796+
// agent disposal will be performed in DisposePlatform().
797+
per_process::v8_platform.StopTracingAgent();
794798
// When the process exits, the tasks in the thread pool may also need to
795799
// access the data of V8Platform, such as trace agent, or a field
796800
// added in the future. So make sure the thread pool exits first.

0 commit comments

Comments
 (0)