Skip to content

trace_event: destroy platform before tracing

For safer shutdown, we should destroy the platform – and platform threads - before the tracing infrastructure is destroyed. This change fixes the relative order of NodePlatform disposition and the tracing agent shutting down. This matches the nesting order for startup.

Make the tracing agent own the tracing controller instead of platform to match the above rationale.

Fixes: https://github.com/nodejs/node/issues/22865

This should fix the thread races we have been observing with trace events. I have been running this on the FreeBSD box that was showing flakes in the CI:

[freebsd@test-digitalocean-freebsd11-x64-2 ~/ofrobots]$ tools/test.py -J test/parallel/test-trace-events-fs-sync.js --repeat 1000
[28:25|% 100|+ 1000|-   0]: Done
[freebsd@test-digitalocean-freebsd11-x64-2 ~/ofrobots]$ tools/test.py -J test/parallel/test-trace-events-fs-sync.js --repeat 9999
[290:38|% 100|+ 9999|-   0]: Done

I believe this makes https://github.com/nodejs/node/commit/92b695ed2690504b7cbc630b3f5c85e7bd87ca55 unnecessary (but harmless). I can revert that if this change sticks and the CI proves that the flakiness is gone.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

CI: https://ci.nodejs.org/job/node-test-pull-request/17302/

Merge request reports

Loading