Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-02-03 17:14:19 +0300
committerAnna Henningsen <anna@addaleax.net>2019-02-05 20:05:20 +0300
commit63ab54248b7dbd315d3e196b456073efd248fc89 (patch)
tree0899e84ff305d25df334b5f7ec53ff7337555f3a /src/node_dtrace.cc
parent9bbe29dcce8ee7830e5589a407e56e9cfcfc2129 (diff)
worker,etw: only enable ETW on the main thread
The Windows ETW code is not written to be compatible with multi threading, and in particular it relies on global state like a single static `uv_async_t`. Adding that to multiple threads would corrupt the corresponding loops' handle queues. This addresses the flakiness of at least `test-worker-exit-code` and very likely other flaky tests that relate to Worker threads on Windows as well. Fixes: https://github.com/nodejs/node/issues/25847 Fixes: https://github.com/nodejs/node/issues/25702 Fixes: https://github.com/nodejs/node/issues/24005 Fixes: https://github.com/nodejs/node/issues/23873 PR-URL: https://github.com/nodejs/node/pull/25907 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_dtrace.cc')
-rw-r--r--src/node_dtrace.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc
index dfabde0747b..0f33f59b338 100644
--- a/src/node_dtrace.cc
+++ b/src/node_dtrace.cc
@@ -288,7 +288,11 @@ void InitDTrace(Environment* env, Local<Object> target) {
}
#ifdef HAVE_ETW
- init_etw();
+ // ETW is neither thread-safe nor does it clean up resources on exit,
+ // so we can use it only on the main thread.
+ if (env->is_main_thread()) {
+ init_etw();
+ }
#endif
#if defined HAVE_DTRACE || defined HAVE_ETW