mirror of
https://github.com/cloudpanel-io/cloudpanel-ce.git
synced 2026-04-05 20:31:58 +02:00
logrotate should send USR1 instead of reloading nginx #148
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kjm33 on 12/20/2024
CloudPanel version(s) affected
2.4.2
Description
Using "/etc/init.d/nginx reload &> /dev/null || true" as postrotate command in lograte rules causes unnecessary reloading nginx for each site which leads to huge memory consumption. In my case with 244 sites, during rotating logs by logrotate RAM consumption for nginx jumps from ~2GB to 40 GB and that triggers OOM killer. According to the nginx documentation sending USR1 signal to master process is sufficient to reload log files.
How to reproduce
Running logrotate in a system with few hundred sites (e.x. 244).
Possible Solution
Replace postrotate command in logrotate commands from:
/etc/init.d/nginx reload &> /dev/null || trueto
[ ! -f /var/run/nginx.pid ] || kill -USR1cat /var/run/nginx.pidAdditional Context
No response