Skip to content

Commit

Permalink
Merge pull request adamfisk#351 from jekh/fix-memory-leak-on-initial-…
Browse files Browse the repository at this point in the history
…request

Fix memory leak on initial requests with HttpObjectAggregator
  • Loading branch information
jekh authored Mar 5, 2017
2 parents d1dffa8 + 08a36bc commit 070e6c1
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,13 @@ void connectionSucceeded(boolean shouldForwardInitialRequest) {
} else {
LOG.debug("Dropping initial request: {}", initialRequest);
}

// we're now done with the initialRequest: it's either been forwarded to the upstream server (HTTP requests), or
// completely dropped (HTTPS CONNECTs). if the initialRequest is reference counted (typically because the HttpObjectAggregator is in
// the pipeline to generate FullHttpRequests), we need to manually release it to avoid a memory leak.
if (initialRequest instanceof ReferenceCounted) {
((ReferenceCounted)initialRequest).release();
}
}

/**
Expand Down

0 comments on commit 070e6c1

Please sign in to comment.