Skip to content
Browse files

http: reset parser.incoming when server response is finished

This resolves a memory leak for keep-alive connections with a naïve

Fixes: #9668

PR-URL: #28646
Reviewed-By: Benjamin Gruenbaum <>
Reviewed-By: Rich Trott <>
  • Loading branch information...
addaleax committed Jul 11, 2019
1 parent 35cb955 commit 779a05d5d1bfe2eeb05386f6415d36f80ca0b3b5
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/_http_server.js
@@ -621,6 +621,8 @@ function resOnFinish(req, res, socket, state, server) {
assert(state.incoming.length === 0 || state.incoming[0] === req);

// Reset the .incoming property so that the request object can be gc'ed.
if (socket.parser) socket.parser.incoming = null;

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

0 comments on commit 779a05d

Please sign in to comment.
You can’t perform that action at this time.