Skip to content
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 session and stream leak #44523

Open
rahbari opened this issue Sep 5, 2022 · 1 comment
Open

HTTP2 session and stream leak #44523

rahbari opened this issue Sep 5, 2022 · 1 comment
Labels
http2 Issues or PRs related to the http2 subsystem.

Comments

@rahbari
Copy link

rahbari commented Sep 5, 2022

Version

v18.7.0

Platform

Linux 4.18.0-372.16.1.el8_6.0.1.x86_64

Subsystem

HTTP2

While using HTTP2 server without any reverse proxy I noticed NodeJs process memory constantly increases, switching back to HTTPS and it works ok.
So I keep track of every HTTP2 stream using a WeakRef. After some hours there are so many valid WeakRefs although their destroyed field is true and session is undefined, also each stream has a buffer of 65kb. I have set HTTP2 Server timeout for 2 minutes, but some of streams are for hours before.
Then I kept a WeakRef to session for each stream, and while the session field of stream in undefined but its WeakRef is valid and the derefed session destroyed field is also true. I checked the remote address of the session in ss output and the connection doesn't exist there too.
I think some of sessions are destroyed but not removed from the sessions poll. It also destroy session streams and set its session to undefined but as it has a pointer in session's stream poll it's not garbage collected.
Maybe this is related to #42710
To overcome the memory increase I have to restart the node process every day and I think it's not really usable in this state.

list of streams:
image

@himself65 himself65 added the http2 Issues or PRs related to the http2 subsystem. label Sep 5, 2022
@ywave620
Copy link
Contributor

Could you provide a snippet of code to reproduce the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http2 Issues or PRs related to the http2 subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants