Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Steps to test:
localhost:3000/status
This is where we'll check memory usage status for our server.npx loadtest --rps 500 http://localhost:3000/ -t 60
. This basically hits our server with 500 requests a second for 60 seconds.Case 1 : Reuse same transport Instances
When Load Test is Running
2 minutes after load test has finished running
Server Logs
Inference : Memory and Heap usage spikes significantly when loadTesting is done, and even after it's over memory usage is persistent. Also note that the serverLogs indicate a possible memoryLeak.
Case 2 : Create new transport Instance
When Load Test Is Running
2 minutes after load test has finished running
Server Logs
Inference: Memory and Heap usage spikes here too, but even when loadTesting is running it spikes down which might indicate that garbage collection took place. It reduces significantly, and comes back to the starting point few seconds after load testing has finished. Also the serverLogs don't indicate any possible memoryLeak.
Reference
https://github.com/precisely/web/pull/368/files
winstonjs/winston#2237
winstonjs/winston#1334 (comment)
Another thing that points to this memory leak, is below heap analysis.
The Console Transport's Shallow Size is close to zero, but it's retained size is very very large. This indicates that because of this transport, all the winston logger instances are retained and haven't been garbage collected yet. This confirms the root cause of memory leak issue to be same reference of transport