-
Notifications
You must be signed in to change notification settings - Fork 229
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
Bug: sometimes the library get stuck on select(). #323
Comments
Thanks this makes a lot of sense. I'll do some testing today |
I think the solution here is maybe like this: diff --git a/ext/curb_multi.c b/ext/curb_multi.c
index 6d6cb2f..a85a8f7 100644
--- a/ext/curb_multi.c
+++ b/ext/curb_multi.c
@@ -634,6 +634,15 @@ VALUE ruby_curl_multi_perform(int argc, VALUE *argv, VALUE self) {
raise_curl_multi_error_exception(mcode);
}
+ if (maxfd == -1) {
+ /* libcurl recommends sleeping for 100ms */
+ rb_thread_wait_for(rb_time_timeval(DBL2NUM(0.1)));
+ rb_curl_multi_run( self, rbcm->handle, &(rbcm->running) );
+ rb_curl_multi_read_info( self, rbcm->handle );
+ if (block != Qnil) { rb_funcall(block, rb_intern("call"), 1, self); }
+ continue;
+ }
+
#ifdef _WIN32
create_crt_fd(&fdread, &crt_fdread);
create_crt_fd(&fdwrite, &crt_fdwrite); the above is how we should handle based on the description provided here:
|
@chanilino, i've put b3d265b into master, if you are able to try again to let me know if this resolves your issue. If not we can reopen and keep trying |
It seems to me that solves the issue. The monday I Will test It harder!! Thanks!! |
Great!
On Sat, Aug 26, 2017 at 12:11 PM Chanilino ***@***.***> wrote:
It seems to me that solves the issue. The monday I Will test It harder!!
Thanks!!
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#323 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAGID-HMvVZV6JEbZ195IRIF_JskfzEks5scEPOgaJpZM4PCaQL>
.
--
…--
todd.fisher@calltrackingmetrics.com <todd.fisher@calltrackingmetrics.com>
Main 800.577.1872 <javascript:void(0);> | Direct 410.394.9424
<javascript:void(0);>
|
I was runing a ruby script like daemon, and it gets stuck. I attach to the proccess with gdb.
I have here results of my investigation:
I see that was stuck in a select. The I try to get the parameters pass to the select:
So I see that we are checking in select for the fd -1, that is wrong. I go to the code of curb and I see this:
https://github.com/taf2/curb/blob/master/ext/curb_multi.c#L630-L636
We check for return code, but not for maxfd value. If we go to libcurl doc:
https://curl.haxx.se/libcurl/c/curl_multi_fdset.html
We see this:
So if maxfd = -1 we need to wait some time and expect this function returns an valid file descriptor. A patch could be something like:
Another solution could be raise an exception like this:
The text was updated successfully, but these errors were encountered: