Skip to content

Commit 4f06524

Browse files
bug #62356 [HttpClient] Fix Warning: curl_multi_select(): timeout must be positive (Jeroeny)
This PR was merged into the 6.4 branch. Discussion ---------- [HttpClient] Fix `Warning: curl_multi_select(): timeout must be positive` | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT Full error text: `ErrorException: Warning: curl_multi_select(): timeout must be between 0 and 2147484` Somehow this timeout is a negative float in some cases. I haven't been able to reproduce it manually. Here's an example: <img width="979" height="920" alt="image" src="https://github.com/user-attachments/assets/57e44026-cb1a-412c-acb2-b94ec13de48e" /> ``` ErrorException: Warning: curl_multi_select(): timeout must be between 0 and 2147484 #0 /vendor/symfony/http-client/Response/CurlResponse.php(342): Symfony\Component\HttpClient\Response\CurlResponse::select #1 /vendor/symfony/http-client/Response/TransportResponseTrait.php(298): Symfony\Component\HttpClient\Response\CurlResponse::stream #2 /vendor/symfony/http-client/Response/CommonResponseTrait.php(148): Symfony\Component\HttpClient\Response\CurlResponse::initialize #3 /vendor/symfony/http-client/Response/TransportResponseTrait.php(130): Symfony\Component\HttpClient\Response\CurlResponse::doDestruct #4 /vendor/symfony/http-client/Response/CurlResponse.php(242): Symfony\Component\HttpClient\Response\CurlResponse::__destruct #5 /vendor/sentry/sentry/src/Client.php(177): Sentry\Client::captureEvent #6 /vendor/sentry/sentry/src/State/Hub.php(155): Sentry\State\Hub::captureEvent #7 /vendor/sentry/sentry/src/Tracing/Transaction.php(188): Sentry\Tracing\Transaction::finish #8 /vendor/..redacted(): ...::shutdownHandler #9 [internal](0) ``` Not sure if this is the place to enforce the `>=0` float or in https://github.com/symfony/symfony/blob/7.4/src/Symfony/Component/HttpClient/Response/CurlResponse.php#L363 Commits ------- 17eec0c Fix Warning: curl_multi_select(): timeout must be positive
2 parents 979e7bf + 17eec0c commit 4f06524

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public static function stream(iterable $responses, ?float $timeout = null): \Gen
299299
continue;
300300
}
301301

302-
if (-1 === self::select($multi, min($timeoutMin, $timeoutMax - $elapsedTimeout))) {
302+
if (-1 === self::select($multi, min($timeoutMin, max(0, $timeoutMax - $elapsedTimeout)))) {
303303
usleep((int) min(500, 1E6 * $timeoutMin));
304304
}
305305

0 commit comments

Comments
 (0)