Roachprod makes it easy to collect a Go core dump. Steps 1 and 2 are already complete by default, and the core files are written to
/mnt/data1/cores. So all you have to do is send
-SIGSEGV to a cockroach that was invoked via
roachprod start, and it’ll dump core.
Alternate approach: gcore
Instead of killing the process, you can use
gdb to get the core dump. To do this:
sudo apt-get install gdb
Look up the pid of the cockroach process.
sudo gcore -o /mnt/data1/cores $PID
Now you’re ready to viewcore! Invoke it like this to get the interactive prompt (and remember to make sure your core was generated with the passed in binary! You will get opaque errors otherwise):