-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http2: fix memory leak caused by premature listener removing #55966
Conversation
Http2Session should always call ondone into JS to detach the handle. In some case, ondone is defered to be called by the StreamListener through WriteWrap, we should be careful of this before getting rid of the StreamListener.
Review requested:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #55966 +/- ##
==========================================
- Coverage 88.40% 88.00% -0.41%
==========================================
Files 654 653 -1
Lines 187815 188091 +276
Branches 36136 35945 -191
==========================================
- Hits 166045 165523 -522
- Misses 15001 15736 +735
- Partials 6769 6832 +63
|
fix test, call gc() twice to enforce a complete GC
@mcollina Thanks for the review, could you rerun the CI ? |
I think it is ready to merge? |
Landed in fb8de03 |
Http2Session should always call ondone into JS to detach the handle. In some case, ondone is defered to be called by the StreamListener through WriteWrap, we should be careful of this before getting rid of the StreamListener. PR-URL: nodejs#55966 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Http2Session should always call ondone into JS to detach the handle. In some case, ondone is defered to be called by the StreamListener through WriteWrap, we should be careful of this before getting rid of the StreamListener. PR-URL: #55966 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Http2Session should always call ondone into JS to detach the handle. In some case, ondone is defered to be called by the StreamListener through WriteWrap, we should be careful of this before getting rid of the StreamListener.
The test case destroys the socket governed by http2. This is not a good practice, but nodejs internal in some case does this too (e.g. when a TCP RESET is received, nodejs internal destroys the socket without bothering it is consumed by a http2 session or not) and it is the simplest code that I can come up with to produce this issue.
I stongly believe that this fixs #42710 based on the issue's description