Bug 2238297 - httpd (Apache) does not resume after suspension
Summary: httpd (Apache) does not resume after suspension
Keywords:
Status: MODIFIED
Alias: None
Product: Fedora
Classification: Fedora
Component: httpd
Version: 38
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Luboš Uhliarik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-09-11 10:03 UTC by Patrick O'Callaghan
Modified: 2024-09-02 11:56 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-12-08 08:17:32 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Patrick O'Callaghan 2023-09-11 10:03:29 UTC
My Fedora system hibernates overnight and resumes successfully every morning, except that the Apache daemon does not resume correctly. Restarting it (apachectl restart) works correctly when invoked manually.

Reproducible: Always

Steps to Reproduce:
1.Run httpd (Apache)
2.Hibernate system
3.Resume system
Actual Results:  
Apache does not resume:
 httpd.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
             /usr/lib/systemd/system/httpd.service.d
             └─php-fpm.conf
     Active: inactive (dead) since Sun 2023-09-10 08:01:34 BST; 19min ago
   Duration: 19h 37min 27.727s
       Docs: man:httpd.service(8)
    Process: 1113 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=0/SUCCESS)
    Process: 49636 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
   Main PID: 1113 (code=exited, status=0/SUCCESS)
     Status: "Total requests: 1021; Idle/Busy workers 100/0;Requests/sec: 0.0223; Bytes served/sec:  59 B/sec"
        CPU: 35.494s

Sep 09 12:24:06 Bree httpd[1113]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.178.21. Set the 'ServerName' directive globally to suppress this message
Sep 09 12:24:06 Bree httpd[1113]: Server configured, listening on: port 443, port 80
Sep 09 12:24:06 Bree systemd[1]: Started httpd.service - The Apache HTTP Server.
Sep 10 00:00:00 Bree systemd[1]: Reloading httpd.service - The Apache HTTP Server...
Sep 10 00:00:00 Bree httpd[49636]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.178.21. Set the 'ServerName' directive globally to suppress this message
Sep 10 00:00:00 Bree systemd[1]: Reloaded httpd.service - The Apache HTTP Server.
Sep 10 00:00:01 Bree httpd[1113]: Server configured, listening on: port 443, port 80
Sep 10 01:05:46 Bree systemd[1]: httpd.service: Sent signal SIGWINCH to main process 1113 (httpd) on client request.
Sep 10 08:01:34 Bree systemd[1]: httpd.service: Deactivated successfully.
Sep 10 08:01:34 Bree systemd[1]: httpd.service: Consumed 35.494s CPU time.


Expected Results:  
Correct resumption of Apache service.

Hibernation is controlled by two systemd units:
$ cat /etc/systemd/system/hibernate-preparation.service 
[Unit]
Description=Enable swap file and disable zram before hibernate
Before=systemd-hibernate.service

[Service]
SyslogIdentifier=%N
User=root
Type=oneshot

#ExecStart=/bin/bash -c '/usr/sbin/swapon /SWAP/swapfile && /usr/sbin/swapoff /dev/zram0'
ExecStart=/bin/bash -c ' \
      if ! swapon --show=NAME --noheadings | grep -q /SWAP/swapfile; then \
          swapon /SWAP/swapfile || exit; \
      fi; \
      swapoff /dev/zram0; \
      # Ignores the exit code of swapoff.
      exit 0; \
        '

[Install]
WantedBy=systemd-hibernate.service

$ cat /etc/systemd/system/hibernate-resume.service 
[Unit]
Description=Disable swap after resuming from hibernation
After=hibernate.target

[Service]
SyslogIdentifier=%N
User=root
Type=oneshot
ExecStartPre=/usr/sbin/swapoff /SWAP/swapfile

[Install]
WantedBy=hibernate.target

Comment 1 Joe Orton 2023-12-07 15:52:57 UTC
Sep 10 01:05:46 Bree systemd[1]: httpd.service: Sent signal SIGWINCH to main process 1113 (httpd) on client request.

Something on your system is stopping the service. Can you tell what from the journal?

Comment 2 Patrick O'Callaghan 2023-12-07 22:23:25 UTC
It turns out that when I thought my system was resuming after hibernation, it was actually restarting because of a hard reset from a smart plug. There is no bug in Apache and this should be closed.

Comment 3 Joe Orton 2023-12-08 08:17:32 UTC
FYI, you can close bugs yourself.

Comment 4 Patrick O'Callaghan 2023-12-08 10:56:48 UTC
(In reply to Joe Orton from comment #3)
> FYI, you can close bugs yourself.

I guess it's obvious when you know how, but I couldn't see how to do it.

A hint would be appreciated for future reference.

Comment 5 Patrick O'Callaghan 2024-09-02 11:56:29 UTC
Coming back to this as the bug is still present. I'm now using suspend instead of hibernate (the smart plug -- see above -- is no longer a factor), and Apache frequently does not resume, i.e. sometimes it does but usually it doesn't. This is a typical log:

$ journalctl --since 00:00 -u httpd
Sep 02 01:38:27 Bree systemd[1]: httpd.service: Sent signal SIGWINCH to main process 906779 (httpd) on client request.
Sep 02 08:00:05 Bree systemd[1]: httpd.service: Sent signal SIGUSR1 to main process 906779 (httpd) on client request.
Sep 02 08:00:05 Bree systemd[1]: httpd.service: Deactivated successfully.
Sep 02 08:00:05 Bree systemd[1]: httpd.service: Consumed 28.975s CPU time.
Sep 02 09:32:20 Bree systemd[1]: Starting httpd.service - The Apache HTTP Server...
Sep 02 09:32:20 Bree (httpd)[1914879]: httpd.service: Referenced but unset environment variable evaluates to an empty string: OPTIONS
Sep 02 09:32:20 Bree httpd[1914879]: Server configured, listening on: port 443, port 80
Sep 02 09:32:20 Bree systemd[1]: Started httpd.service - The Apache HTTP Server.

i.e. system is timed to wake up at 08:00, but when I log in at 09:30 Apache is not running, and there are no errors in the journal. I then start it manually.


Note You need to log in before you can comment on or make changes to this bug.