treasure-data / serverengine

A framework to implement robust multiprocess servers like Unicorn
Apache License 2.0
759 stars 86 forks source link

Using with systemd results in a lot of useless /tmp/sigdump-* files #92

Closed gmitrev closed 6 years ago

gmitrev commented 6 years ago

serverengine listens to the SIGCONT signal and dumps stacktrace and memory information to /tmp/sigdump-${PID}.log. This does not play well with systemd because it sends a SIGCONT signal every time it tries to stop a service:

Note that, right after sending the signal specified in this setting, systemd will always send SIGCONT, to ensure that even suspended tasks can be terminated cleanly. (https://www.freedesktop.org/software/systemd/man/systemd.kill.html)

The result of this is a lot of unneeded /tmp/sigdump-*.log files being generated on our servers that should be cleaned up manually.

Is there a way to disable this without monkey-patching the signal here - https://github.com/treasure-data/serverengine/blob/master/lib/serverengine/worker.rb#L72?

tagomoris commented 6 years ago

Wow! It should be configurable.... Patches are welcome if you can write it :)

gmitrev commented 6 years ago

I've created a PR (https://github.com/treasure-data/serverengine/pull/93) that resolves this so I'm closing the issue for now.

robinbowes commented 6 years ago

I would suggest that changing the signal used to trigger the dump would be the best option: https://github.com/treasure-data/serverengine/blob/678bb269ab13e62277d28981b0c7047b146e72dd/lib/serverengine/signals.rb#L29

Perhaps SIGUSR1 ?