Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upConfiguring a reporter as an empty array create a memory leak #534
Comments
This comment has been minimized.
This comment has been minimized.
Yeah that sounds right to me. Though I wouldn't technically call it a memory leak... more like a out of bounds buffer? |
ianwsperber
added a commit
to ianwsperber/good
that referenced
this issue
Nov 18, 2016
ianwsperber
added a commit
to ianwsperber/good
that referenced
this issue
Nov 18, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Though obviously an edge case, if a reporter configuration is set to an empty array (essentially blank) then good will write all log messages for that reporter to a stream that is never emptied, resulting in a memory leak. From what I can tell this is due to the check here https://github.com/hapijs/good/blob/master/lib/monitor.js#L128, which should add the
NoOp
stream according to the conditionstreamObjs.length <= 1
, notstreamObjs.length === 1
.I discovered this problem when I configured a dev mode only reporter, which in my confidence file was achieved by setting the reporter to an empty array. It was only in production that enough logs were generated to make the leak evident.
I am putting together a PR for this issue presently. However I will need to confirm this fixes the memory leak prior to creating the PR.