node/test/parallel/test-process-exit-GH-12322.js
Ben Noordhuis 5ef6000afd src: don't call uv_run() after 'exit' event
It makes timers and other libuv handles fire intermittently after the
'exit' event, contrary to what the documentation states.

Regression introduced in commit aac79df ("src: use stack-allocated
Environment instances") from June last year that made the
`while (handle_cleanup_waiting_ != 0) uv_run(event_loop(), UV_RUN_ONCE)`
loop run unconditionally on exit because it merged CleanupHandles() into
the Environment destructor.

This change breaks parallel/test-async-wrap-throw-from-callback because
the async_wrap idle handle is no longer cleaned up, which I resolved
pragmatically by removing the test.

In all seriousness, it is being removed in the upcoming async_wrap
revamp - it doesn't make sense to sink a lot of time in it now.

Fixes: https://github.com/nodejs/node/issues/12322
PR-URL: https://github.com/nodejs/node/pull/12344
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-19 11:11:41 +02:00

8 lines
193 B
JavaScript

'use strict';
require('../common');
process.on('exit', () => {
setTimeout(process.abort, 0); // Should not run.
for (const start = Date.now(); Date.now() - start < 10; /* Empty. */);
});