Repository navigation
[BUGFIX] Restart Apache on Alpine with supervisorctl and after an unclean exit - #631
Merged
Kanti merged 1 commit intoNov 17, 2026
Merged
Conversation
…lean exit On Alpine, the start script ran httpd through apachectl, a shell script that does not exec it. supervisorctl stop and restart ended apachectl, but httpd kept running with its old configuration, and the new one exited with "httpd (pid N) already running", over and over. The script also removed /var/run/httpd/httpd.pid, while Apache on Alpine writes /run/apache2/httpd.pid, so after an unclean exit a pid file that names a running process kept Apache from starting. The script now removes /run/apache2/httpd.pid and execs httpd itself. The image tests restart Apache with a new configuration and a pid file that names a running process, and check the configuration and that Apache keeps running.
|
Kanti
marked this pull request as ready for review
November 17, 2026 12:50
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
On Alpine, the start script of Apache runs httpd through
apachectl, a shell script that does notexecit.supervisorctl stopandrestartendapachectl, but httpd keeps running with its old configuration, and the new start exits withhttpd (pid N) already running, over and over. The script also removes/var/run/httpd/httpd.pid, while Apache on Alpine writes/run/apache2/httpd.pid, so after an unclean exit a pid file that names a running process keeps Apache from starting.The script now removes
/run/apache2/httpd.pidand runsexec /usr/sbin/httpd -DFOREGROUND. Debian already execsapache2.Related: #457 (wrong pid path in the Alpine images, boot loop after an unclean exit), closed, but it still applies to the published images; #458 (pull request with the pid path, against files that are no longer generated, without the
apachectlpart).Changes
provisioning/apache/alpine/bin/service.d/httpd.sh,provisioning/php-apache/alpine/bin/service.d/httpd.sh: the pid file of Alpine, andexec httpdinstead ofapachectl;make generate.testSupervisorctlRestartsApacheinApacheChecks: adds a configuration with a header, stops Apache, writes a pid file that names supervisord, starts Apache, and checks the header and that Apache keeps its process for 6 s.How it was verified
The published
php-apache:8.5-alpine, with and without the newhttpd.shmounted over/opt/docker/bin/service.d/httpd.sh: a configuration with a header added,supervisorctl stop apache:apached,echo 1 > /run/apache2/httpd.pid,supervisorctl start apache:apached:httpd.shX-Image-Test-Restart: restartedsupervisorctl pid apache:apachedImage tests from the fork, with the new
httpd.shcopied into the published images:apache:alpinephp-apache:8.5-alpinephp-apache:8.5(Debian)Rebased on master with #630;
ci/console generatechanges nothing. The CI run of this pull request runs the new test in the Apache images, Debian and Alpine, amd64 and arm64.Nginx images
Nginx is not affected. Its start script already runs
exec /usr/sbin/nginx -g 'daemon off;', on Debian and Alpine. Checked on the publishedphp-nginx:8.5-alpine: aftersupervisorctl restart nginx:nginxdthe program isRUNNING, there is one Nginx master process, Nginx answers, and the log has noalready running. This pull request does not change Nginx.