-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix setopt handling of timeouts #17571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The checks for a connection being "too long idle" or "too old" where rounding down the elapsed time to seconds before comparing to the configured max values. This caused connections to be reused for up to 999ms longer than intended. Change the compares to scale the configured seconds up to ms, so connection will properly be "too old" 1 ms after the coonfigured values. Fixes sporadic failures of test1542 on platforms where "sleep(2)" returnes before 2 full seconds on the internal clock where passed. Reporter: Christian Weisgerber via curl-library mailing list
We can fix these by capping the values already in |
Maybe make the internal fields a |
…lpers which cap values the same way between second and ms variants.
A little bit broader brush stroke in this PR. Have a common handling of most timeout values in setopt and change the timeout vars to Interestingly, there are platforms where |
The checks for a connection being "too long idle" or "too old" where rounding down the elapsed time to seconds before comparing to the configured max values. This caused connections to be reused for up to 999ms longer than intended. Change the compares to scale the configured seconds up to ms, so connection will properly be "too old" 1 ms after the coonfigured values. Fixes sporadic failures of test1542 on platforms where "sleep(2)" returnes before 2 full seconds on the internal clock where passed. Reported-by: Christian Weisgerber URL: https://curl.se/mail/lib-2025-06/0004.html Closes curl#17571
Change the internal timeout fields to type
timediff_t
and check validity when setting the option with common helper functions for these timeouts. Cap too large values silently toTIMEDIFF_T_MAX
.The checks for a connection being "too long idle" or "too old" were rounding down the elapsed time to seconds before comparing to the configured max values. This caused connections to be reused for up to 999ms longer than intended.
Fixes sporadic failures of test1542 on platforms where "sleep(2)" returnes before 2 full seconds on the internal clock had passed.
Reporter: Christian Weisgerber via curl-library mailing list