src: fix race condition in `~NodeTraceBuffer` · nodejs/node@e28d891 · GitHub
Skip to content

Commit e28d891

Browse files
committed
src: fix race condition in ~NodeTraceBuffer
Libuv does not guarantee that handles have their close callbacks called in the order in which they were added (and in fact, currently calls them in reverse order). This patch ensures that the `flush_signal_` handle is no longer in use (i.e. its close callback has already been run) when we signal to the main thread that `~NodeTraceBuffer` may be destroyed. The same applies for `~NodeTraceWriter`. Credit for debugging goes to Gireesh Punathil. Fixes: #25512 Co-authored-by: Gireesh Punathil <gpunathi@in.ibm.com> PR-URL: #25896 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
1 parent 025a7c3 commit e28d891

2 files changed

Lines changed: 33 additions & 17 deletions

File tree

src/tracing/node_trace_buffer.cc

Lines changed: 18 additions & 7 deletions

src/tracing/node_trace_writer.cc

Lines changed: 15 additions & 10 deletions

0 commit comments

Comments
 (0)