-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
curl_multi_poll
hangs forever on negative timeout
#4763
Comments
Using a negative timeout is undocumented, so you're hitting undefined
behaviour. Don't do undefined things if you don't want to be surprised by what
happens.
|
Positive and zero are also undocumented. The is simply no documentation on which values are valid. One has to document something first before claiming that everything else is undocumented. |
- Add new error CURLM_BAD_FUNCTION_ARGUMENT and return that error when curl_multi_wait/poll is passed timeout param < 0. Prior to this change passing a negative value to curl_multi_wait/poll such as -1 could cause the function to wait forever. Reported-by: hamstergene@users.noreply.github.com Fixes curl#4763 Closes #xxxx
It's implied though we should error if negative. I couldn't find a good error code for it so I've added one in #4765 and if approved that will address this issue in the release after next. |
- Add new error CURLM_BAD_FUNCTION_ARGUMENT and return that error when curl_multi_wait/poll is passed timeout param < 0. Prior to this change passing a negative value to curl_multi_wait/poll such as -1 could cause the function to wait forever. Reported-by: hamstergene@users.noreply.github.com Fixes curl#4763 Closes #xxxx
- Add new error CURLM_BAD_FUNCTION_ARGUMENT and return that error when curl_multi_wait/poll is passed timeout param < 0. Prior to this change passing a negative value to curl_multi_wait/poll such as -1 could cause the function to wait forever. Reported-by: hamstergene@users.noreply.github.com Fixes curl#4763 Closes #xxxx
I don't understand why we cannot accept -1 for "forever" so that this functions like POSIX poll(). It's easy to make it behave properly with expiry timeouts: I'd submitted a PR for it before realising that this new validation had been added, which breaks my fix. #4932 |
…t be a positive value (to do not error on libcurl >= 7.69.0) When compiling sysdig with libcurl >= 7.69.0 `timeout_ms` equal to `-1` causes `curl_multi_wait` to return an error ([ref](https://github.com/jay/curl/blob/master/lib/multi.c#L1056-L1057)). This new behaviour has been introduced with [0](https://github.com/jay/curl/commit/b700662b1c77c8af7e290538f748b71d75a79ae7.patch). More details on the reasoning behind this choice can be found in this [issue](curl/curl#4763). So, to obtain the same behavior disregarding the libcurl version sysdig has been built with, this patch increases the `timeout_ms` value to `1000`. Please notice that this does not mean it will use `1000` as timeout value since internally `curl_multi_wait` sets the actual timeout value to `timeout_internal` in case this is less than the passed `timeout_ms` argument. Co-authored-by: Lorenzo Fontana <lo@linux.com> Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
…t be a positive value (to do not error on libcurl >= 7.69.0) When compiling sysdig with libcurl >= 7.69.0 `timeout_ms` equal to `-1` causes `curl_multi_wait` to return an error ([ref](https://github.com/jay/curl/blob/master/lib/multi.c#L1056-L1057)). This new behaviour has been introduced with [0](https://github.com/jay/curl/commit/b700662b1c77c8af7e290538f748b71d75a79ae7.patch). More details on the reasoning behind this choice can be found in this [issue](curl/curl#4763). So, to obtain the same behavior disregarding the libcurl version sysdig has been built with, this patch increases the `timeout_ms` value to `1000`. Please notice that this does not mean it will use `1000` as timeout value since internally `curl_multi_wait` sets the actual timeout value to `timeout_internal` in case this is less than the passed `timeout_ms` argument. Co-authored-by: Lorenzo Fontana <lo@linux.com> Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
This program hangs forever
I expected the following
The function interface takes signed integer (
int
) it must be ready to handle negative numbers.curl/libcurl version
7.68.0-20191218
operating system
macOS 10.14.6
The text was updated successfully, but these errors were encountered: