Bug Report
Restify Version
Tested on 7.7.0, almost definitely present in all versions due to underlying Node issue.
Node.js Version
v10.15.1, likely present in all versions of Node.
Expected behaviour
No infinite loop
Actual behaviour
Infinite loop
Repro case
const restify = require('restify');
const http = require('http');
const server = restify.createServer({ handleUncaughtExceptions: true });
server.on('uncaughtException', () => {
console.log('catching exception!');
http.get('http://google.com', () => { throw new Error('foobar'); });
});
server.get('/', () => { throw new Error('fail'); });
server.listen(2000, () => console.log('Server now up on port 2000'));
Cause
This is caused by this issue in node.
Are you willing and able to fix this?
Yes.
There is a workaround available for this issue, which would be to change on to once here. If the restify team is on board with this change, I'm happy to submit a PR.