Skip to content

Grabbing a heap dump

Amber Yust edited this page Aug 14, 2017 · 3 revisions

Note: grabbing a heap dump generally requires additional free memory equal to the size of the heap, so memory usage will temporarily double while the heap is being dumped. (Also, the size of the resulting heap dump file will be roughly comparable to the size of the heap, so be prepared for a potentially large download, and try to avoid keeping a ton of dumps around on pepperoni.)

  1. Find the PID of the process (note that there are generally two node processes running, one of roster and roster-staging; I typically use htop to find the one that's actively using the CPU when I make requests).
  2. sudo kill -USR2 <pid> will trigger a heap dump to be written to the /app directory of the container.
  3. sudo dokku enter roster (or roster-staging as appropriate).
  4. Note: it can take up to 10-15 seconds for the dump to finish writing after the signal is sent; check that the file size of the dump has stopped growing before proceeding to step 5.
  5. mv heapdump-* ../roster/storage/ (or ../roster-staging/storage/) to move the heapdump file to where it's more easily accessible outside the container.
  6. exit the container shell.
  7. Grab the heapdump file from /var/lib/dokku/data/storage/roster/ and use as desired.
Clone this wiki locally