Skip to content

Commit 30d783f

Browse files
santigimenojuanarbol
authored andcommitted
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 c0d3fda commit 30d783f

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
@@ -797,6 +797,10 @@ void DefaultProcessExitHandler(Environment* env, int exit_code) {
797797
env->set_can_call_into_js(false);
798798
env->stop_sub_worker_contexts();
799799
env->isolate()->DumpAndResetStats();
800+
// The tracing agent could be in the process of writing data using the
801+
// threadpool. Stop it before shutting down libuv. The rest of the tracing
802+
// agent disposal will be performed in DisposePlatform().
803+
per_process::v8_platform.StopTracingAgent();
800804
// When the process exits, the tasks in the thread pool may also need to
801805
// access the data of V8Platform, such as trace agent, or a field
802806
// added in the future. So make sure the thread pool exits first.

0 commit comments

Comments
 (0)