graphite-project / carbon

Carbon is one of the components of Graphite, and is responsible for receiving metrics over the network and writing them down to disk using a storage backend.
http://graphite.readthedocs.org/
Apache License 2.0
1.5k stars 490 forks source link

[BUG] carbon-cache-a.service cannot reload. #889

Closed Fischeertrinken closed 4 years ago

Fischeertrinken commented 4 years ago

Hey, every Night when the Logrotate tries to reload the carbon-cache-a.service, the carbon-cache-a.service dies. Also when i try it from console: sudo systemctl reload carbon-cache-a.service Result: carbon-cache-a.service - Graphite Carbon Cache (instance a) Loaded: loaded (/usr/local/lib/systemd/system/carbon-cache-a.service; enabled; vendor preset: enabled) Active: failed (Result: signal) since Wed 2020-04-22 17:22:49 CEST; 2s ago Process: 26176 ExecReload=/bin/kill -USR1 $MAINPID (code=exited, status=0/SUCCESS) Process: 26076 ExecStart=/data/app/graphite/bin/carbon-cache.py --instance=a --config=/data/app/graphite/conf/carbon.conf --pidfile=/var/run/carbon-cache-a.pid --logdir=/var/log/carbon/ start (code=exited, status=0/SUCCESS) Main PID: 26082 (code=killed, signal=USR1) Graphite is working on Ubunutu18.04. We use carbon with Graphite for Icinga2. Python 2.7.15

Has somebody a solution? If y need more information, just tell me!

Thanks! Have a great day!

piotr1212 commented 4 years ago

Some issues with your service unit? Could you post it? /usr/local/lib/systemd/system/carbon-cache-a.service

ploxiln commented 4 years ago

It looks like carbon has no mention of SIGUSR1. It configures SIGHUP to be ignored. For both of these signals, the default behavior if not configured, is to terminate the process.

ExecReload=/bin/kill -USR1 $MAINPID

I think that was never going to work. If you look at the sample init.d scripts, to reload, carbon has to be stopped and started again. I think that if you just don't specify ExecReload for the systemd service, then systemd will know that it has to "restart" the service, it can't "reload" it.

For logrotate ... you may want to use the "copytruncate" mode instead, so you don't need to have carbon restart. Or you may want to configure carbon to just log to stdout/stderr using the --debug flag, so that systemd/journald takes care of log management without any reload/restart.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.