Using heapdump, I'm trying to take some heap snapshots of node
as per https://blog.risingstack.com/finding-a-memory-leak-in-node-js/
Sending USR2 to a node process that has required heapdump should trigger heapdump to save a heap snapshot to the working directory.
On my local server (running on a mac) this works great. On an AWS ubuntu server, USR2 kills the process. I've also tried SIGUSR2.
Does anyone know why "sudo kill -USR2 " would be killing the process instead of triggering a heap snapshot?
This could happen because of two reasons:
In some distros the kill code is USR2
and in others it's SIGUSR2
. You need to run kill -l
to check which one your distro supports.
require('heapdump')
is not executed in the current worker. So if you are use node cluster
module then you need to require heapdump in the current worker i.e.
if (worker.isMaster) { /* master stuff */ } else { require('heapdump') }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With