Steps to reproduce/verify on Bionic: === Similarly to steps described for Xenial. Skipping the identical steps. $ lxc launch ubuntu:bionic lp1863232b $ lxc exec lp1863232b -- su - ubuntu One connection/Two requests (added timestamps to check timeout values) --- $ (cat http-request; sleep 1; cat http-request; sleep 9) | telnet 127.0.0.1 80 2>&1 | while read line; do echo "$(date +'%T') == $line"; done 00:03:46 == Trying 127.0.0.1... 00:03:46 == Connected to 127.0.0.1. 00:03:46 == Escape character is '^]'. 00:03:46 == HTTP/1.1 200 OK 00:03:46 == Date: Tue, 18 Feb 2020 00:03:46 GMT 00:03:46 == Server: Apache/2.4.29 (Ubuntu) 00:03:46 == Content-Length: 13 00:03:46 == Vary: Accept-Encoding 00:03:46 == Keep-Alive: timeout=15, max=100 00:03:46 == Connection: Keep-Alive 00:03:46 == Content-Type: text/plain 00:03:46 == 00:03:46 == Hello World! 00:03:47 == HTTP/1.1 200 OK 00:03:47 == Date: Tue, 18 Feb 2020 00:03:47 GMT 00:03:47 == Server: Apache/2.4.29 (Ubuntu) 00:03:47 == Content-Length: 13 00:03:47 == Vary: Accept-Encoding 00:03:47 == Keep-Alive: timeout=15, max=99 00:03:47 == Connection: Keep-Alive 00:03:47 == Content-Type: text/plain 00:03:47 == 00:03:47 == Hello World! 00:03:56 == Connection closed by foreign host. Reproduce the problem by placing 'sudo systemctl reload apache2' between the two HTTP requests (second request hits Error 503, depending on apache2 MPM module. mpm_event just closes connection, mpm_worker/mpm_prefork hit 503) --- $ lsb_release -cs bionic $ dpkg -s libapache2-mod-wsgi | grep ^Version Version: 4.5.17-1 $ sudo a2dismod mpm_event $ sudo a2enmod mpm_worker $ sudo systemctl restart apache2 For reference on socket filename: $ sudo systemctl restart apache2 $ ls -1 /var/run/apache2/wsgi.*.sock /var/run/apache2/wsgi.4982.0.1.sock $ (cat http-request; sleep 1; sudo systemctl reload apache2; sleep 5; cat http-request; sleep 9) | telnet 127.0.0.1 80 2>&1 | while read line; do echo "$(date +'%T') == $line"; done 14:46:04 == Trying 127.0.0.1... 14:46:04 == Connected to 127.0.0.1. 14:46:04 == Escape character is '^]'. 14:46:04 == HTTP/1.1 200 OK 14:46:04 == Date: Tue, 18 Feb 2020 14:46:04 GMT 14:46:04 == Server: Apache/2.4.29 (Ubuntu) 14:46:04 == Content-Length: 13 14:46:04 == Vary: Accept-Encoding 14:46:04 == Keep-Alive: timeout=15, max=100 14:46:04 == Connection: Keep-Alive 14:46:04 == Content-Type: text/plain 14:46:04 == 14:46:04 == Hello World! 14:46:10 == HTTP/1.1 503 Service Unavailable 14:46:10 == Date: Tue, 18 Feb 2020 14:46:10 GMT 14:46:10 == Server: Apache/2.4.29 (Ubuntu) 14:46:10 == Content-Length: 374 14:46:10 == Connection: close 14:46:10 == Content-Type: text/html; charset=iso-8859-1 14:46:10 == 14:46:10 == 14:46:10 == 14:46:10 == 503 Service Unavailable 14:46:10 == 14:46:10 ==

Service Unavailable

14:46:10 ==

The server is temporarily unable to service your 14:46:10 == request due to maintenance downtime or capacity 14:46:10 == problems. Please try again later.

14:46:10 ==
14:46:10 ==
Apache/2.4.29 (Ubuntu) Server at 127.0.0.1 Port 80
14:46:11 == 14:46:11 == Connection closed by foreign host. $ sudo tail /var/log/apache2/error.log ... [Tue Feb 18 14:46:05.923939 2020] [mpm_worker:notice] [pid 4982:tid 139825593654208] AH00297: SIGUSR1 received. Doing graceful restart [Tue Feb 18 14:46:05.981362 2020] [mpm_worker:notice] [pid 4982:tid 139825593654208] AH00292: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/2.7 configured -- resuming normal operations [Tue Feb 18 14:46:05.981409 2020] [core:notice] [pid 4982:tid 139825593654208] AH00094: Command line: '/usr/sbin/apache2' [Tue Feb 18 14:46:10.941713 2020] [wsgi:error] [pid 4986:tid 139825361426176] (2)No such file or directory: [client 127.0.0.1:37514] mod_wsgi (pid=4986): Unable to connect to WSGI daemon process '127.0.0.1' on '/var/run/apache2/wsgi.4982.0.1.sock' as user with uid=33. $ ls -1 /var/run/apache2/wsgi.*.sock /var/run/apache2/wsgi.4982.1.1.sock With the fix/patch for Bionic: --- $ sudo add-apt-repository ppa:mfo/lp1863232v2 $ sudo apt update $ sudo apt install -y libapache2-mod-wsgi $ sudo systemctl restart apache2 $ dpkg -s libapache2-mod-wsgi | grep ^Version Version: 4.5.17-1ubuntu1 Same behavior by default: --- $ ls -1 /var/run/apache2/wsgi.*.sock /var/run/apache2/wsgi.6043.0.1.sock $ sudo systemctl reload apache2 $ ls -1 /var/run/apache2/wsgi.*.sock /var/run/apache2/wsgi.6043.1.1.sock $ sudo systemctl reload apache2 $ ls -1 /var/run/apache2/wsgi.*.sock /var/run/apache2/wsgi.6043.2.1.sock Now, manually changing it: --- $ echo 'WSGISocketRotation Off' | sudo tee -a /etc/apache2/conf-enabled/wsgi.conf $ sudo systemctl restart apache2 Notice name pattern change as in patch. (u33 = UID 33 = www-data:) And socket file name remains constant: $ ls -1 /var/run/apache2/wsgi.*.sock /var/run/apache2/wsgi.6403.u33.1.sock $ sudo systemctl reload apache2 $ ls -1 /var/run/apache2/wsgi.*.sock /var/run/apache2/wsgi.6403.u33.1.sock $ sudo systemctl reload apache2 $ ls -1 /var/run/apache2/wsgi.*.sock /var/run/apache2/wsgi.6403.u33.1.sock $ id -un 33 www-data Check the problem by placing 'sudo systemctl reload apache2' between the two HTTP requests (second request hits Error 500 now) --- The second HTTP request (after reload) no longer hits Error 503, but now Error 500, and the log file no longer mentions file not found, but a different message. The Error 500 is observed in/consistent with Eoan as well, thus not a missing patch or something -- this is an improvement. $ (cat http-request; sleep 1; sudo systemctl reload apache2; sleep 5; cat http-request; sleep 9) | telnet 127.0.0.1 80 2>&1 | while read line; do echo "$(date +'%T') == $line"; done 14:49:57 == Trying 127.0.0.1... 14:49:57 == Connected to 127.0.0.1. 14:49:57 == Escape character is '^]'. 14:49:57 == HTTP/1.1 200 OK 14:49:57 == Date: Tue, 18 Feb 2020 14:49:57 GMT 14:49:57 == Server: Apache/2.4.29 (Ubuntu) 14:49:57 == Content-Length: 13 14:49:57 == Vary: Accept-Encoding 14:49:57 == Keep-Alive: timeout=15, max=100 14:49:57 == Connection: Keep-Alive 14:49:57 == Content-Type: text/plain 14:49:57 == 14:49:57 == Hello World! 14:50:03 == HTTP/1.1 500 Internal Server Error 14:50:03 == Date: Tue, 18 Feb 2020 14:50:03 GMT 14:50:03 == Server: Apache/2.4.29 (Ubuntu) 14:50:03 == Content-Length: 607 14:50:03 == Connection: close 14:50:03 == Content-Type: text/html; charset=iso-8859-1 14:50:03 == 14:50:03 == 14:50:03 == 14:50:03 == 500 Internal Server Error 14:50:03 == 14:50:03 ==

Internal Server Error

14:50:03 ==

The server encountered an internal error or 14:50:03 == misconfiguration and was unable to complete 14:50:03 == your request.

14:50:03 ==

Please contact the server administrator at 14:50:03 == webmaster@localhost to inform them of the time this error occurred, 14:50:03 == and the actions you performed just before this error.

14:50:03 ==

More information about this error may be available 14:50:03 == in the server error log.

14:50:03 ==
14:50:03 ==
Apache/2.4.29 (Ubuntu) Server at 127.0.0.1 Port 80
14:50:03 == 14:50:03 == Connection closed by foreign host. $ sudo tail /var/log/apache2/error.log ... [Tue Feb 18 14:49:58.563491 2020] [mpm_worker:notice] [pid 6403:tid 139801328274368] AH00297: SIGUSR1 received. Doing graceful restart [Tue Feb 18 14:49:58.619982 2020] [mpm_worker:notice] [pid 6403:tid 139801328274368] AH00292: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/2.7 configured -- resuming normal operations [Tue Feb 18 14:49:58.620021 2020] [core:notice] [pid 6403:tid 139801328274368] AH00094: Command line: '/usr/sbin/apache2' [Tue Feb 18 14:50:03.581491 2020] [wsgi:alert] [pid 6735:tid 139801212405504] mod_wsgi (pid=6735): Request origin could not be validated. [Tue Feb 18 14:50:03.581691 2020] [wsgi:error] [pid 6614:tid 139801220822784] [client 127.0.0.1:37590] Truncated or oversized response headers received from daemon process '127.0.0.1': /var/www/html/hello-world.py