Repository navigation
THRIFT-1509: Retry interrupted stream_select in PHP TSocket - #4161
Open
slachiewicz wants to merge 1 commit into
Open
slachiewicz wants to merge 1 commit into
slachiewicz wants to merge 1 commit into
Conversation
Client: php A signal during stream_select makes it return false with errno EINTR, which read() and write() reported as a fatal transport error. They now retry while the suppressed warning says "[4]" / "Interrupted system call" (or 10004 on Windows). The remaining time is recomputed from hrtime(), so interrupts do not restart the configured timeout. Any other false still throws. Tested with pcntl_alarm on a stream_socket_pair; the lib-php job now enables pcntl so these tests run in CI instead of being skipped. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
slachiewicz
marked this pull request as ready for review
November 8, 2026 20:16
slachiewicz
requested review from
Jens-G,
fishy,
jimexist and
sveneld
as code owners
November 8, 2026 20:16
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: THRIFT-1509
A signal arriving during
stream_selectmakes it returnfalsewith EINTR, whichTSocket::read()andwrite()reported as a fatal transport error. Both now retry when the suppressed warning names the interrupted system call ([4], or10004on Windows). The remaining time is recomputed fromhrtime(), so interrupts do not restart the configured timeout; any otherfalsestill throws.The new tests use
pcntl_alarmand are marked#[RequiresFunction('pcntl_alarm')], so this also addspcntlto thelib-phpjob's PHP extensions; without it they would be skipped there.Verified:
vendor/bin/phpunit -c lib/php/phpunit.xml lib/php/test/Unit/Lib/Transport/TSocketTest.php→ the 3 new tests fail on master and pass here (34 tests); phpcs and phpstan (lib/php/phpstan.neon) clean; actionlint clean.