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

[CL-00] fix: Fixes memory leak #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tathagat2000
Copy link
Owner

@tathagat2000 tathagat2000 commented Feb 20, 2024

Steps to test:

  • yarn build
  • yarn start
  • open localhost:3000/status This is where we'll check memory usage status for our server.
  • Run this command 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
image

2 minutes after load test has finished running
image

Server Logs
image

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
image

2 minutes after load test has finished running
image

Server Logs
image

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.
image

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

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.

1 participant