[php-src] PR #25918: Fix GH-25915: Data race on CLI stdio stream open counters in ZTS
| From: | lazerg | Date: | Mon, 30 Nov 2026 02:42:55 +0000 |
| Subject: | [php-src] PR #25918: Fix GH-25915: Data race on CLI stdio stream open counters in ZTS | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41226@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25918
Author: lazerg
Under ZTS, threads that open php://stdout or php://stderr in the CLI all do
cli_out++ /
cli_err++ on a shared static int, which TSan flags as a data race. The counters only
decide whether this open gets the real stdio FILE * or a dup'd fd, so I replaced
them with a zend_atomic_bool claimed by exchange. I did the same for php://stdin so
concurrent first opens can't both get stdin.
I checked it with a TSan ZTS embed build where 16 threads open php://stderr at once: it reports the
race before the change and is clean after.
Fixes #25915