Skip to content

Commit

Permalink
http: reset parser.incoming when server response is finished
Browse files Browse the repository at this point in the history
This resolves a memory leak for keep-alive connections with a naïve
approach.

Fixes: nodejs#9668
  • Loading branch information
addaleax committed Jul 11, 2019
1 parent ca0884a commit 609e2c2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ function resOnFinish(req, res, socket, state, server) {
assert(state.incoming.length === 0 || state.incoming[0] === req);

state.incoming.shift();
if (socket.parser) socket.parser.incoming = null;

// If the user never called req.read(), and didn't pipe() or
// .resume() or .on('data'), then we call req._dump() so that the
Expand Down

0 comments on commit 609e2c2

Please sign in to comment.