ZTS: pcntl signal handled by one PHP thread ends the process or is lost when delivered elsewhere
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 43/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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)
- 主要言語
- C
- スター
- 41.8k
- フォーク
- 8.6k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 125
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
php/php-src のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
ext/openssl: 8.2.31+/8.3.31+ fail to build against OpenSSL 1.0.2 (ASN1_STRING_get0_data in xp_ssl.c)オープンExtension: openssl Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
php/php-src#25402 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
php/php-src#25397 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
SNMP accepts malformed remote ports対応中かも @somethingwithproof が 21 日前に担当しました。 オープン
難易度 2/5 半日 初心者へのやさしさ 62/100
php/php-src#25137 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
ZIP/ZIPS decode dereferences NULL when the cached libdeflate decompressor can't be allocated (3.5 regression)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
AcademySoftwareFoundation/openexr#2884 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
python-pillow/Pillow#10590 ·
メンテナーはふだん 1 日以内に返信
-
status: needs-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
openwrt/packages#31407 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信