tripwire icon indicating copy to clipboard operation
tripwire copied to clipboard

Doesn't work with Node 4 LTS

Open rpaterson opened this issue 9 years ago • 3 comments

Tripwire doesn't seem to work properly with the latest Node 4 LTS (v4.2.4). The example in the README:

process.on('uncaughtException', function (e) {
  console.log('The event loop was blocked for longer than 2000 milliseconds');
  process.exit(1);
});

// set the limit of execution time to 2000 milliseconds
tripwire.resetTripwire(2000);

// execute code that will block the event loop for longer
while(true);

// clear the tripwire (in this case this code is never reached)
tripwire.clearTripwire();

In Node v0.10 it pauses for 2 seconds and then prints The event loop was blocked for longer than 2000 milliseconds to the console before exiting. In Node v4.2.4 it pauses and then exits without printing anything.

In other more complicated examples sometimes I get unexpectedException:

Error: Blocked event loop.
    at Error (native)
    at processImmediate [as _immediateCallback] (timers.js:367:26)

... or ...

TypeError: immediate._onImmediate is not a function
    at processImmediate [as _immediateCallback] (timers.js:383:17)

rpaterson avatar Jan 13 '16 19:01 rpaterson

Note when the process exits the exit code is 0.

rpaterson avatar Jan 13 '16 19:01 rpaterson

(I'm on Linux)

rpaterson avatar Jan 13 '16 19:01 rpaterson

/samples/sample_exceptions.js and /samples/sample_perpertuum_mobile.js do work, but /samples/sample_sandboxing.js does not - it prints only [Malcolm] Ha ha ha! I am taking over your event loop, Albert. Ha ha ha! and then exits with exit code 0.

rpaterson avatar Jan 13 '16 19:01 rpaterson