php / php/php-src

If "php-fpm --nodaemonize" is called to be sent into background it forces itself into FG and hangs the calling process

Open
#10,058 5 comments 0 reactions 1 assignee View on GitHub

@bukka is already working on this.

Since Dec 6, 2022.

Bug SAPI: fpm
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

php-fpm process executed in a FG mode using --nodaemonize but sent to background using shell's &, is puting itself back into FG and locks the calling process, completely breaking the intended logic.

The following bash shell code:

#!/bin/bash

function fpm_LaunchProcess()
{
    /usr/sbin/php-fpm --nodaemonize 2>&1>/dev/null &
    echo "$!"
}

pid=$(fpm_LaunchProcess)
echo "$pid"

Expected:
Printing the executed FPM process pid.

Actual behaviour:
Process is stalled due to php-fpm coming back into FG by itself

The bug added sometime in between PHP 8.0.23 to 8.0.25(Included).
PHP 8.1 is affected too and I think the issue added in the same releases window as mentioned 8.0 versions.

Also adding a 'nohup' before php-fpm did not help.

PHP Version

PHP 8.0.26

Operating System

CentOS 7.9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.