chrisa / node-dtrace-provider

Native DTrace probes for node.js apps
Other
319 stars 70 forks source link

Some tests are flaky under newer node versions due to probe getting GC'd #126

Closed melloc closed 5 years ago

melloc commented 5 years ago

The 32probe-char.test.js and32probe.test.js tests are flaky under node v8. After some investigation, I realized that it was a similar problem to #90, except that in this case both provider and probe are unreferenced, and they can get GC'd before the dtrace command is executed, which causes it to fail to find the probe, and it never runs the child JS script.

We can move the provider object up to the top level, and then call provider.disable() at the very end of the script, so that we can make sure it and the probes never get collected.