You have to set the 2 following line in unit file:
LimitCORE=infinity # unlimited core file size
Environment=”GOTRACEBACK=crash”
example:
[Unit]
Description=
[Service]
User=toto
WorkingDirectory=/home/toto
LimitCORE=infinity
Environment="GOTRACEBACK=crash"
ExecStart=/usr/local/bin/my-super-go-programm -port 2401
[Install]
WantedBy=multi-user.target
In case of panic core files will be stored in /home/toto. You can load them in a debugger for analysis.
Go offers this nice feature out of the box: when you send it SIGQUIT signal, it exits with a stack dump. The stack dump is shown for all goroutines, so you can know what each “thread” was doing at the time of receiving SIGQUIT
.
kill -QUIT <pid>
So in practice you can test the proper working of this coredump activation.
Leave a Reply