Skip to content

sapi/fpm/tests/tester.inc can send SIGUSR2 to pid 0, killing run-tests.php #24695

Open

Description

@Bill-Sommerfeld

Description

While testing OpenIndiana/oi-userland#28065, OpenIndiana/oi-userland#28066, and OpenIndiana/oi-userland#28067, (packaging 8.3.36, 8.4.27, and 8.5.12, respectively), I observed test runs aborting with a "User Signal 2" or "zsh: user-defined signal 2" error (the exact error depends on which shell you're running).

Digging further I caught the test sapi/fpm/tests/bug80024-socket-reduced-inherit.phpt invoking kill -USR2 0; this sends a SIGUSR2 signal to the current process group, killing both the test and the run-tests.php test runner, aborting the test run.

I worked around this with the attached "no-kill-zero.patch" which declines to send a signal if it can't find a non-zero pid. With this patch in place, run-tests.php can run to completion on openindiana.

no-kill-zero.patch

Example of a run clobbered by this (without the patch):

builder@builder:/z/ws/oi-userland-dev/components/web/php/php-8_5$ gmake test COMPONENT_TEST_ARGS="TESTS=sapi/fpm/tests/bug80024-socket-reduced-inherit.phpt"
/bin/rm -f -r /z/ws/oi-userland-dev/components/web/php/php-8_5/build/test/amd64
/bin/mkdir -p /z/ws/oi-userland-dev/components/web/php/php-8_5/build/test/amd64
(cd /z/ws/oi-userland-dev/components/web/php/php-8_5/build/amd64 ; \
        /usr/bin/env -i CARGO_HOME="/z/ws/oi-userland-dev/components/web/php/php-8_5/build/amd64/.cargo" PATH="/usr/gcc/14/bin:/usr/clang/21/bin:/usr/ruby/3.2/bin:/usr/jdk/openjdk21/bin:/usr/postgres/16/bin:/usr/mariadb/10.6/bin:/usr/openssl/3/bin:/usr/bin/amd64:/usr/bin:/usr/gnu/bin:/usr/sbin/amd64:/usr/sbin" NO_INTERACTION=yes \
        /usr/gnu/bin/make \
        TESTS=sapi/fpm/tests/bug80024-socket-reduced-inherit.phpt test) \
        |& /usr/bin/tee /z/ws/oi-userland-dev/components/web/php/php-8_5/build/test/amd64/test-64-results

Build complete.
Don't forget to run 'make test'.


=====================================================================
PHP         : /z/ws/oi-userland-dev/components/web/php/php-8_5/build/amd64/sapi/cli/php 
PHP_SAPI    : cli
PHP_VERSION : 8.5.12
ZEND_VERSION: 4.5.12
PHP_OS      : SunOS - SunOS builder 5.11 illumos-de1199e407 i86pc
INI actual  : /z/ws/oi-userland-dev/components/web/php/php-8_5/build/amd64/tmp-php.ini
More .INIs  :  
---------------------------------------------------------------------
PHP         : /z/ws/oi-userland-dev/components/web/php/php-8_5/build/amd64/sapi/cgi/php-cgi 
PHP_SAPI    : cgi-fcgi
PHP_VERSION : 8.5.12
ZEND_VERSION: 4.5.12
PHP_OS      : SunOS - SunOS builder 5.11 illumos-de1199e407 i86pc
INI actual  : /z/ws/oi-userland-dev/components/web/php/php-8_5/build/amd64/tmp-php.ini
More .INIs  : 
--------------------------------------------------------------------- 
---------------------------------------------------------------------
PHP         : /z/ws/oi-userland-dev/components/web/php/php-8_5/build/amd64/sapi/phpdbg/phpdbg 
PHP_SAPI    : phpdbg
PHP_VERSION : 8.5.12
ZEND_VERSION: 4.5.12
PHP_OS      : SunOS - SunOS builder 5.11 illumos-de1199e407 i86pc
INI actual  : /z/ws/oi-userland-dev/components/web/php/php-8_5/build/amd64/tmp-php.ini
More .INIs  : 
---------------------------------------------------------------------
CWD         : /z/ws/oi-userland-dev/components/web/php/php-8_5/php-8.5.12
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
Running selected tests.
User Signal 2              gmake test COMPONENT_TEST_ARGS="TESTS=sapi/fpm/tests/bug80024-socket-reduced-inherit.phpt"

Output for 8.3.x and 8.4.x is similar.

PHP Version

Observed while running `make test` after builds of 8.3.36, 8.4.27, and 8.5.12 on openindiana.

Operating System

Openindiana

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions