You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constrestify=require('restify');consthttp=require('http');constserver=restify.createServer({handleUncaughtExceptions: true});constdelay=100;server.pre((req,res,next)=>{console.log(`Inflight requests: ${server.inflightRequests()}`);next();});server.get('/',(req,res,next)=>{setTimeout(()=>{thrownewError('foo');},delay);});server.on('uncaughtException',(req,res)=>res.send('foo'));server.listen(8080,()=>{console.log('Server now up on port 8080');setInterval(()=>{constreq=http.get("http://localhost:8080/").on('error',()=>{});setTimeout(()=>req.abort(),delay/2);},delay);});
Cause
Something in Restify's domain handling causes this function to never get called with res._handlersFinished === true:
I'm still working out the precise bug here but I should be able to trace more precisely what the bug is from there and update this ticket with more details.
Are you willing and able to fix this?
Yes (but extra eyes are appreciated)
The text was updated successfully, but these errors were encountered:
cprussin
changed the title
Restify inflight request counter leaks when using domains and throwing an error after connection is aborted
Restify inflight request counter leaks when using handleUncaughtExceptions and throwing an exception after connection is aborted
Mar 26, 2019
Bug Report
Restify Version
Proven reproducible on 8.2.0 and 7.3.0
Node.js Version
Proven reproducible on v8.15.0 and v10.15.1
Expected behaviour
Restify inflight counter should not leak
Actual behaviour
Restify inflight counter leaks
Repro case
Cause
Something in Restify's domain handling causes this function to never get called with
res._handlersFinished === true
:node-restify/lib/server.js
Line 1347 in f363b36
I'm still working out the precise bug here but I should be able to trace more precisely what the bug is from there and update this ticket with more details.
Are you willing and able to fix this?
Yes (but extra eyes are appreciated)
The text was updated successfully, but these errors were encountered: