Now let's compare restart behavior with systemctl and apache2ctl. Again,
with questing, same as comment above.


a) systemctl

Restart really stops everything, and starts it again.

Looking at stop + start as defined in the systemd unit, a restart invokes:
apachectl graceful-stop --> apache2 -k graceful-stop
apachectl start

This is what we want in a package upgrade, generally: graceful-stop will
not abort open connections.


PIDs all change (no connection open in this example):

root@q-apachectl:~# pidof apache2
3468 3467 2980
root@q-apachectl:~# systemctl restart apache2
root@q-apachectl:~# pidof apache2
4320 4319 4317

Apache receives SIGWUNCH:
[Fri Mar 27 17:54:02.072749 2026] [mpm_event:notice] [pid 2980:tid 2980] 
AH00492: caught SIGWINCH, shutting down gracefully


systemd is tracking the correct processes as expected:
root@q-apachectl:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: 
enabled)
     Active: active (running) since Fri 2026-03-27 17:54:02 UTC; 16s ago
 Invocation: 5e1fbc43f9784b3bb76295aa3975c749
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 4314 ExecStart=/usr/sbin/apachectl start (code=exited, 
status=0/SUCCESS)
   Main PID: 4317 (apache2)
      Tasks: 55 (limit: 9242)
     Memory: 4.9M (peak: 5.7M)
        CPU: 41ms
     CGroup: /system.slice/apache2.service
             ├─4317 /usr/sbin/apache2 -k start
             ├─4319 /usr/sbin/apache2 -k start
             └─4320 /usr/sbin/apache2 -k start



b) apache2ctl restart
Here restart sends a SIGHUP, and the parent process remains.

root@q-apachectl:~# pidof apache2
4320 4319 4317
root@q-apachectl:~# apache2ctl graceful
graceful       graceful-stop  
root@q-apachectl:~# apache2ctl restart
root@q-apachectl:~# pidof apache2
4530 4529 4317
root@q-apachectl:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: 
enabled)
     Active: active (running) since Fri 2026-03-27 17:54:02 UTC; 5min ago
 Invocation: 5e1fbc43f9784b3bb76295aa3975c749
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 4314 ExecStart=/usr/sbin/apachectl start (code=exited, 
status=0/SUCCESS)
   Main PID: 4317 (apache2)
      Tasks: 55 (limit: 9242)
     Memory: 4.9M (peak: 5.7M)
        CPU: 97ms
     CGroup: /system.slice/apache2.service
             ├─4317 /usr/sbin/apache2 -k start
             ├─4529 /usr/sbin/apache2 -k start
             └─4530 /usr/sbin/apache2 -k start

[Fri Mar 27 17:58:35.745458 2026] [mpm_event:notice] [pid 4317:tid 4317]
AH00494: SIGHUP received.  Attempting to restart

This will abort current open connections, differently from graceful
(which sends SIGUSR1).

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1832182

Title:
  systemd unable to detect running apache if invoked via "apache2ctl
  graceful"

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1832182/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to