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

MaxListenersExceededWarning: Possible EventEmitter memory leak detected #7

Closed
cchance27 opened this issue Oct 26, 2021 · 11 comments · Fixed by #10
Closed

MaxListenersExceededWarning: Possible EventEmitter memory leak detected #7

cchance27 opened this issue Oct 26, 2021 · 11 comments · Fixed by #10
Labels
bug Something isn't working

Comments

@cchance27
Copy link

Since i enabled critical-css i see this in my build.

node:26304) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(Use node --trace-warnings ... to show where the warning was created)
(node:26304) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGTERM listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(node:26304) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added to [process]. Use emitter.setMaxListeners() to increase limit

@gregives gregives added the bug Something isn't working label Nov 3, 2021
@gregives
Copy link
Owner

gregives commented Nov 3, 2021

That seems weird, I'll take a look! What version of Eleventy and eleventy-critical-css are you using? Do you have a repository I can clone to investigate further?

@WebShapedBiz
Copy link

Same here with eleventy 1.0.0-beta.8. The build breaks with the error "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory"

@christopherpickering
Copy link

I have a repo you can test - https://github.com/atlas-bi/website

I've always gotten this message and just ignored it probably started with 11ty v0.10.0 and still get it in 1.0.0.

@christopherpickering
Copy link

Hey @gregives did you have a chance to check this out?

@gregives
Copy link
Owner

Hi @christopherpickering sorry I haven't taken a look yet, I might have some time tomorrow to investigate. As the code for eleventy-critical-css is only 20 lines long, I imagine the problem actually lies the critical dependency

@christopherpickering
Copy link

Hmm, yeah, you're right. I wonder if because 11ty is processing the pages async that penthouse gets overloaded?

@gregives
Copy link
Owner

I think that's right, critical or penthouse seems to register more and more listeners without checking process.getMaxListeners() which causes this error. I'll try to look into it more tomorrow…

@gregives
Copy link
Owner

I've taken a look at this and I don't think the error is coming from eleventy-critical-css but from critical, probably related to this issue. I will open another issue in the critical repository, to see if they can investigate it further.

If you want the warning to go away, you can either increase the limit or turn the limit off, like so:

process.setMaxListeners(100); // Increase the limit
process.setMaxListeners(0); // Turn off the limit

However, be aware of what you are doing before you include those lines of code. There is a StackOverflow thread here with some useful context.

@tpiros
Copy link

tpiros commented Mar 10, 2022

As a follow up @gregives would you be so kind to link the issue # from critical here, once you've opened it please?

@gregives
Copy link
Owner

Reopening this issue as it's still a problem and hasn't been solved upstream in critical, I'll be releasing a fix for this soon!

@gregives gregives reopened this Oct 17, 2023
@gregives gregives changed the title Running against a 1.0.0 site getting max-listener warnings? MaxListenersExceededWarning: Possible EventEmitter memory leak detected Oct 17, 2023
@gregives
Copy link
Owner

This has been fixed in v2.0.2, let me know if you have any problems with it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants