Package: varnish
Version: 7.7.0-3
Severity: normal
Tags: patch

The systemd service file for varnishncsa does not invoke the daemon
mode. However the ExecReload sends SIHGHUP to the process. According to
the manpage:

    Rotate the log file (see -w option) in daemon mode, abort the loop
    and die gracefully when running in the foreground.

As the process thinks it's running in the foreground, the logrotate
postrotate script does systemctl try-reload-or-restart which effectively
kills the process.

I suggest changing the systemd service file to invoke the daemon mode;
I've attached a patch that seems to work for me.

Thanks,
Paul

-- System Information:
Debian Release: 13.0
  APT prefers stable
  APT policy: (800, 'stable'), (500, 'stable-updates'), (500, 
'stable-security'), (500, 'oldstable-updates'), (500, 'oldstable-security'), 
(500, 'unstable'), (500, 'oldstable'), (100, 'trixie-fasttrack'), (100, 
'bookworm-fasttrack'), (100, 'bookworm-backports-staging')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
--- /lib/systemd/system/varnishncsa.service     2025-06-08 13:43:35.000000000 
+0200
+++ /etc/systemd/system/varnishncsa.service     2025-10-14 11:04:25.353741661 
+0200
@@ -4,10 +4,13 @@
 After=varnish.service
 
 [Service]
-Type=exec
+# Type=exec
+Type=forking
 User=varnishlog
 Group=varnish
-ExecStart=/usr/bin/varnishncsa -a -w /var/log/varnish/varnishncsa.log
+RuntimeDirectory=varnishncsa
+PIDFile=/run/varnishncsa/varnishncsa.pid
+ExecStart=/usr/bin/varnishncsa -a -D -P %t/varnishncsa/varnishncsa.pid -w 
/var/log/varnish/varnishncsa.log
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
 LogsDirectory=varnish

Reply via email to