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

MEMORY LEAK on https module. #31285

Closed
StephenLynx opened this issue Jan 9, 2020 · 10 comments
Closed

MEMORY LEAK on https module. #31285

StephenLynx opened this issue Jan 9, 2020 · 10 comments
Labels
memory Issues and PRs related to the memory management or memory footprint.

Comments

@StephenLynx
Copy link

Node version: 12.14.1

What is the scenario: an open connection for incoming https requests.
What is the issue: a site with moderate traffic had crashes due to ENOMEM every 30 minutes. Site is about 500k ranking on alexa.
Why I think the issue is a leak on https module:
1: The site operator got this warning once: MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 drain listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit
2: As soon as the site operator stopped using the SSL on the node software and instead let nginx handle ssl and just redirect to http to the software, the issue stopped.

The usage of https in this case can be seen here:
https://gitgud.io/LynxChan/LynxChan/blob/master/src/be/workerBoot.js#L80

@bnoordhuis
Copy link
Member

I'm afraid there isn't much to go on without more info. Is there a way for us to reproduce? Did you take heap snapshots or anything else that might shed more light on memory consumption?

@StephenLynx
Copy link
Author

StephenLynx commented Jan 9, 2020

I am not the site operator, so no. I don't know anything else. The guy can barely run his server, so I can't count on him. You can probably reproduce by just serving requests through the https module.

Edit: ok, I can see if I can get something out him. I just get heap snapshots after memory is bloated?

@bnoordhuis
Copy link
Member

I just get heap snapshots after memory is bloated?

That would be helpful but before/after snapshots would be even better.

@addaleax addaleax added the memory Issues and PRs related to the memory management or memory footprint. label Jan 10, 2020
@addaleax
Copy link
Member

For the warning, starting Node as node --trace-warnings might be helpful.

@StephenLynx
Copy link
Author

https://files.catbox.moe/gsc49t.zip The -1 is for the first worker process. His server only has 1 core, so there was only a single worker process. @bnoordhuis

@ronag
Copy link
Member

ronag commented Jan 12, 2020

Just to be clear. You are sure he is running https and not http2?

@StephenLynx
Copy link
Author

I am sure, @ronag. I made http2 opt-out due to the crashes caused by the compatibility layer, confirmed with the site operator http2 was not enabled and it would have been crashing A LOT if it were.

@StephenLynx
Copy link
Author

@ronag @bnoordhuis @addaleax so, were the dumps useful?

@gugu
Copy link

gugu commented Jun 16, 2020

Node 14.4.0.

Here is a part of heapdump:

image

@mcollina
Copy link
Member

I think this could be closed, feel free to reopen otherwise.

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

No branches or pull requests

6 participants