ZTS: pcntl signal handled by one PHP thread ends the process or is lost when delivered elsewhere
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 43/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- operating-systems
Línea de trabajo
Start by tracing ZTS signal registration, delivery, and request shutdown in the PHP source; the issue names pcntl_signal(), RSHUTDOWN, zend signals, and the pthread embed SAPI reproduction, but no source files or tests. Reproduce both cases on a debug ZTS build, with and without --disable-zend-signals, and inspect the related GH-25542 and GH-10193 discussions. Done means a handler registered by one live PHP thread runs when either described signal delivery case occurs, without terminating the process or losing the signal.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
Signal dispositions are process-wide, but under ZTS the PHP handler for a signal belongs to the thread that registered it. With several threads running PHP requests (an embedding application, for instance), a signal handled by one thread can end the process or be lost. GH-25542 fixes delivery to threads that never ran PHP, but these two cases remain.
1. A signal lands on a PHP thread that has no handler for it.
- Thread A runs a request and calls
pcntl_signal(SIGUSR1, $handler). - Thread B runs a request and has no handler for
SIGUSR1. SIGUSR1is delivered to thread B.
2. Two threads handle the same signal and one finishes first.
- Threads A and B each run a request and call
pcntl_signal(SIGUSR1, $handler). - Thread B finishes its request.
SIGUSR1is delivered to a thread that never ran PHP, while thread A is still running.
I reproduced both with a small embed SAPI program that runs each request on its own pthread and calls raise() on the target thread. Each result below is 10 of 10 runs, on a debug ZTS build:
| Case | With zend signals | With --disable-zend-signals |
|---|---|---|
| 1. PHP thread without a handler | Process terminated by SIGUSR1 |
Signal lost, A's handler never runs |
| 2. Same signal, one thread finished | Process terminated by SIGUSR1 |
Process terminated by SIGUSR1 |
I expected thread A's handler to run in every case.
The results are the same with and without GH-25542. In case 2 without zend signals, thread B's RSHUTDOWN resets the signal to SIG_DFL for the whole process while thread A still relies on it.
This looks related to the discussion in GH-10193 about making the zend signal state process-wide rather than per thread.
PHP Version
PHP-8.4 branch (8.4.29-dev)
Operating System
macOS (arm64)
- Lenguaje dominante
- C
- Estrellas
- 41.8k
- Forks
- 8.6k
- Merge medio
- 2 d 15 h
- PR fusionados (30 d)
- 125
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de php/php-src
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
ext/openssl: 8.2.31+/8.3.31+ fail to build against OpenSSL 1.0.2 (ASN1_STRING_get0_data in xp_ssl.c)AbiertoExtension: openssl Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
php/php-src#25402 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
php/php-src#25397 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
SNMP accepts malformed remote portsPosiblemente ocupada @somethingwithproof la tomó hace 21 días. Abierto
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
php/php-src#25137 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
Todos los issues de php/php-src
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
ZIP/ZIPS decode dereferences NULL when the cached libdeflate decompressor can't be allocated (3.5 regression)Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
AcademySoftwareFoundation/openexr#2884 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
python-pillow/Pillow#10590 ·
Los mantenedores suelen responder en 1 día
-
status: needs-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
openwrt/packages#31407 · 1 comentario ·
Los mantenedores suelen responder en 1 día