-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Add portable way to unblock/alert blocking curl_multi_wait from another thread #4418
Comments
Yes it would be useful and I'm sure appreciated by other users too. No, libcurl doesn't have anything like that internally already. |
Somewhat related quick question: I use CURLOPT_CONNECT_ONLY (for websockets) and when I Is it curl bug, or I need to dome something else to close connection? |
I tried to set CURLOPT_FORBID_REUSE and CURLOPT_CONNECT_ONLY, but in this case nothing works: after connect succeeds I cannot make any sends, curl_easy_send weirdly returns CURLE_UNSUPPORTED_PROTOCOL. I use 7.64.1 (when we tried to switch to 7.65.3 we had catastrophic TLS 5x-10x overload on our load balancers and it was not related to connection max age and wasn't related to that bug that divided max age time twice. We had to roll back as an emergency for now) |
That sounds like a totally different issue than "unblocking" curl_multi_wait from another thread. If this is a bug, please file this as a separate issue with details to allow us to reproduce. |
I've jotted down some ideas for curl_multi_unblock in the wiki. I'm interested in feedback and comments! |
I think an interesting issue is whether a socket always |
This commit adds curl_multi_unblock() which was previously in the TODO list. To enable the functionality a new setopt option CURLMOPT_ENABLE_UNBLOCK has been also added. On some platforms and with some configurations this feature might not be available or can fail, in these cases a new error code (CURLM_UNBLOCK_FAILURE) is returned from curl_multi_setopt() or from curl_multi_unblock(). Fixes curl#4418
This commit adds curl_multi_wakeup() which was previously in the TODO list under the curl_multi_unblock name. On some platforms and with some configurations this feature might not be available or can fail, in these cases a new error code (CURLM_WAKEUP_FAILURE) is returned from curl_multi_wakeup(). Fixes curl#4418
This commit adds curl_multi_wakeup() which was previously in the TODO list under the curl_multi_unblock name. On some platforms and with some configurations this feature might not be available or can fail, in these cases a new error code (CURLM_WAKEUP_FAILURE) is returned from curl_multi_wakeup(). Fixes #4418 Closes #4608
I'm very happy with curl :) but the way I implemented http code in our project is by using 1ms busy wait worker thread that doesn't even use
curl_multi_wait
. It simply sleeps(1ms) and then does curl_multi_perform. One of the reasons is because I wasn't able to (or rather didn't want to) implement portable code that would be able to "unblock" curl_multi_wait call if I needed to. On non-windows systems generally it's a simple task: an anonymous pipe can be used to alert curl_multi_wait. On windows however, this won't work as select on windows requires socket to be passed. It would be helpful if libcurl instead provided through some api a way to unblock curl_multi_wait call from another thread (perhaps internally it already has something like that?).On non-windows systems it may implement it as anonymous pipe. On windows it may use self-connected udp socket (this way nobody on localhost would be able to send data to it).
The text was updated successfully, but these errors were encountered: