-
Notifications
You must be signed in to change notification settings - Fork 1.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
Unbind uncaught exception/rejection event listeners on close #1824
Conversation
for uncaught exceptions and rejections. Closes a small memory leak observed in Issue #1706.
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.
This looks good, thank you! 🤞 that this solves all of that issue.
When is this change going to make into a release? |
@wbt can you share your example with code of how you apply a workaround without waiting for a release? so far I've updated yarn dependency to use git ref:
as it's just one commit since the 3.3.3 release this is the cleanest fix |
@glensec Updating to the git ref seems like a reasonable solution! The workaround part of my code includes the following:
The undefined checks are probably not all necessary in your code, but are helpful in mine because not all loggers are Winston objects. Edited 12/2/2021 to use typeof comparison instead of direct comparison to undefined. |
I think this should have been done inside If we take a look at the configure method, old Lines 99 to 111 in 34bed86
If we had previous handlers registered manually or via use of flags Because @DABH you're the one who approved and merged it, please take a look. |
@unconfident You make a good point; however in |
Attempts to address comment: winstonjs#1824 (comment)
Any idea when this fix will be released? It was merged 11 months ago, but the last release was 3 weeks shy of a year ago. |
I'm just really interested in this fix getting out the door. EDIT: For anyone else interested/waiting, I saw the author @DABH published some other NPM packages 3 months ago. It would be great to get some word from them. |
Thanks to @DABH for commenting; moving thread back to here. @fearphage seems interested in helping with that maintenance burden and I might be able to chip in as well, to help get a new release out. Do you have any notes on that release process you might be willing to share, even privately, so as to avoid missing something important? |
Sure, can you guys email me? My email is $(npm view yadeep maintainers.email) |
Attempts to address [comment](winstonjs#1824 (comment)) by @unconfident
Attempts to address [comment](#1824 (comment)) by @unconfident
This patch hopefully fixes Issue #1706, closing a small memory leak evident when loggers are repeatedly opened and closed. It has only been lightly rather than rigorously tested (issue observed without but not with the patch), but is submitted in the hopes it may be helpful.
Until such time as the patch is adopted into Winston core, the workaround is to call
logger.exceptions.unhandle();
and/orlogger.rejections.unhandle();
before calling logger.close(); on a logger that was created or subsequently altered to havehandleExceptions
and/orhandleRejections
(respectively)true
.For semver purposes, this seems like a patch-level bump on release.