Code development platform for open source projects from the European Union institutions

Skip to content

🐛 Wait for `httpd` by watching its PID file

David Jose DELASSUS requested to merge apache-waiter into main

Decision record

We are using the mpm_prefork module for Apache2+ModSecurity. This means Apache2 will fork itself into multiple processes.

This does not play nicely with procfusion and the start script start-webserver.sh. We used to run httpd -DFOREGROUND, but we had a weird case of SEGFAULT in Apache2, which was killing the parent process and not the child processes.

This somehow led to some confusion in procfusion which was unable to properly detect that httpd had stopped, and therefore was not killing the other processes (which would end up in the container restarting, the behavior we want).

To fix this, we run Apache2 in background and simply watch its PID file. If the PID specified there does not respond to the signal 0 (no-op), then httpd must have stopped (even partially), we exit the script, letting procfusion know that it can exit as intended.

Changes

  • 🔧 Enable PID file in Apache2 configuration
  • Run httpd in background and wait PID file

Merge request reports

Loading