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

fix: MaxListenersExceededWarning when much loggers share same transport #1867

Closed

Conversation

adoyle-h
Copy link
Contributor

fix #1791

@adoyle-h
Copy link
Contributor Author

@indexzero @jcrugzz @DABH @ChrisAlderson Can you review the PR?

@devonik
Copy link

devonik commented Jul 20, 2022

I don't think this will be ok. As I understood you should not do target.setMaxListeners(Infinity);. Because then you just ignore the Warning

Instead of this the real problem should be fixed.

@wbt wbt closed this Jul 21, 2022
@wbt
Copy link
Contributor

wbt commented Jul 21, 2022

I think it is possible to use the proposed new code in your calling context to silence the warning until there's a real fix in.

@devonik
Copy link

devonik commented Jul 21, 2022

In my case i didn't find the bug and maybe it has to do with the winston package. I always get the warning on uncaughtException listener.
As solution I do following (entry point of lambda in this case):
process.removeAllListeners('uncaughtException') process.on('uncaughtException', (error) => { logger.error("uncaughtException from lambda entrypoint", { stack: error }) })

@wbt
Copy link
Contributor

wbt commented Jul 21, 2022

It's possible the issue is in Winston code, but silencing the warning in Winston isn't a fix of the root cause. If the warning is annoying you should be able to silence it in your own code.

@adoyle-h adoyle-h deleted the fix/MaxListenersExceededWarning branch July 22, 2022 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MaxListenersExceeded Warning logged to the console
3 participants