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
{{ message }}
Repository navigation
node:http: the request of a pipelined response destroyed while queued never emits 'aborted', 'error' or 'close' #43512
Two requests arrive pipelined on one connection. The 'request' listener destroys the second response while it is still queued behind the first one. The second request then never emits 'aborted', 'error' or 'close'. A consumer that waits for the end of that request (for await, stream.finished, a body parser) never settles.
Repro
consthttp=require("node:http");constnet=require("node:net");constevents=[];constserver=http.createServer((req,res)=>{if(req.url==="/1")returnvoidsetTimeout(()=>res.end("one"),50);req.on("aborted",()=>events.push("req2 aborted"));req.on("error",e=>events.push("req2 error:"+e.code));req.on("close",()=>events.push("req2 close"));res.on("close",()=>events.push("res2 close"));req.resume();res.destroy();// res2 is still queued behind res1});server.listen(0,"127.0.0.1",()=>{constc=net.connect(server.address().port,"127.0.0.1");c.on("error",()=>{});c.write("GET /1 HTTP/1.1\r\nHost: a\r\n\r\nPOST /2 HTTP/1.1\r\nHost: a\r\nContent-Length: 10\r\n\r\nabc");setTimeout(()=>c.destroy(),500);setTimeout(()=>{console.log(events.join(", "));server.close();},1000);});
Node v26.3.0: res2 close, req2 aborted, req2 error:ECONNRESET, req2 close
advanceResponsePipeline in src/js/node/_http_server.ts shifts the destroyed response out of socket[kPipelinedResponses] and then destroys the socket (the res.destroyed || !handle branch). It does not touch res.req. The response never became socket._httpMessage, so NodeHTTPServerSocket#onClose does not find the request. abortQueuedPipelinedResponses does not find it either, because the response is no longer in the queue. The next branch (startPipelinedResponse returns false) has the same gap.
abortQueuedPipelinedResponses already shows how such a request is aborted: req.destroy(new ConnResetException("aborted")) when the request has an 'error' listener, req.destroy() otherwise.
Activity
robobun commentedon Sep 19, 2026
Reproduced: the repro prints only
res2 closeon Bun 1.4.3, Node prints the four events.Fix: #43549 covers this case (verified with a test on that branch). Test branch: main...robobun/303b7617/pipelined-destroyed-res-abort-req
node:http: the server follows Node (request body, framing, response f…