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: request body bytes that arrived with the headers are dropped when the 'request' listener destroys the connection #43513
A request arrives with its body in the same TCP segment as its headers. The 'request' listener reads the request and destroys the connection in the same tick. Node.js still delivers the body bytes that it already has. When the body is complete, Node.js emits 'data' and 'end' and does not abort the request. Bun drops the bytes and aborts the request.
Node v26.3.0: req data:10, req end, req close (complete=true)
Bun 1.4.3 (canary 367d939): req aborted, req error:aborted, req close (complete=false)
With a partial body (Content-Length: 10, 3 bytes sent) Node.js emits req data:3 and then aborts the request. Bun aborts the request without the 'data' event.
Cause (from a read of the code)
uWS calls the request handler first and delivers the body bytes of the same read after the handler returns. packages/bun-uws/src/HttpContext.h stops parsing at that point when the socket is closed (the us_socket_is_closed check after the router call). The body bytes that are already in the read buffer never reach NodeHTTPResponse::on_data.
The Node.js parser (parserOnBody, parserOnMessageComplete) continues through the buffer in the same execute() call. The socket 'close' event that aborts open requests comes later.
Related: #38196 keeps the body of the current read for a response that ends early with res.end(). This report is the destroy() side.
Reproduced with Bun 1.4.3 and a debug build of main: bun repro.js 10 prints req aborted, req error:aborted, req close (complete=false).
Fix in progress: #43602 (covers req.socket.destroy() and res.destroy()).
Reproduced with Bun 1.4.3 and a debug build of main: bun repro.js 10 printed req aborted, req error:aborted, req close (complete=false).
Fixed by #43557 (merged, 5d5f03f). #43602 was superseded by it.
Activity
robobun commentedon Sep 19, 2026
Reproduced with Bun 1.4.3 and a debug build of main:
bun repro.js 10printsreq aborted, req error:aborted, req close (complete=false).Fix in progress: #43602 (covers
req.socket.destroy()andres.destroy()).robobun commentedon Sep 19, 2026
Reproduced with Bun 1.4.3 and a debug build of main:
bun repro.js 10printedreq aborted, req error:aborted, req close (complete=false).Fixed by #43557 (merged, 5d5f03f). #43602 was superseded by it.
node:http: a close during a parse waits for the message that is being…
node:http: a close during a parse waits for the message that is being…
node:http: the server follows Node (request body, framing, response f…