Skip to content

Conversation

arnaud-lb
Copy link
Member

@arnaud-lb arnaud-lb commented Oct 6, 2025

Possible alternative fix for GH-20051 (#20051 (comment))

Preloading may fork a process and wait for it to finish. In case waitpid() is interrupted, the parent exits with a fatal error. This is fine when the syscall is interrupted by a signal whose disposition is set to terminate the process, but not otherwise.

In the apache2handler SAPI, the parent is the control process. Restarting apache2 is done by sending SIGUSR1 or SIGHUP to the control process. Doing that during the waitpid() syscall would cause the control process to exit instead.

Block the USR1 and HUP signals from being delivered during the syscall when running the apache2handler SAPI, as these are not supposed to terminate the process.

FPM is fine as it masks relevant signals during php startup.

cc @welcomycozyhom @dstogov

* Block the USR1 and HUP signals from being delivered during the
* syscall when running the apache2handler SAPI, as these are not
* supposed to terminate the process. See GH-20051. */
bool is_apache2handler = strcmp(sapi_module.name, "apache2handler") == 0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A possible alternative to this check would be to mask signals in php_apache_server_startup, similarly to FPM.

@arnaud-lb arnaud-lb marked this pull request as ready for review October 6, 2025 17:04
@arnaud-lb arnaud-lb requested a review from dstogov as a code owner October 6, 2025 17:04
Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants