Memory Leak NodeJS
Hi!
Our server has some memory leakage that we can't catch locally.
Would like to save the dump of production and then analyze it.
But you don't have any way to download the heapdump file
How we could catch our production memory leakage?
12 Replies
Project ID:
N/A
You could upload the output file from the heapdump into S3/R2, whatnot
How to upload? With application itself?
ServiceID = 7e617622-11d1-46f0-b104-7884c8728782
How are you generating your heapdump file within node?
v8.writeHeapSnapshot();
you can specify a
filename
to writeHeapSnapshot
which is the path where your file will be saved.
From there, you can either use a buffer or a stream to read it, and use any third party library to upload your file to a storage service. You might already use some service for thatso, application itself should upload it
your node application, yes
Thank you!
One more question here. Looks like you keep all application's logs. Is their size included in application's memory metrics?
Jeremy doesn't work for Railway, and neither do I, but I can confidently say that logs are absolutely not part of the memory metrics, but that's a fair question indeed
Thank you Brody. I am just trying to figure out the issue
could be due to different node versions? on railway node 18.17.1 is used by default
id first try getting the environment railway is running your app in as close to the environment you can run locally, this means writing a Dockerfile for railway, making sure the memory error is still there on railway, then run the Dockerfile locally since it would be so much easier to profile the running image locally