curl-library
RE: Timer left at 0 and firing over and over. Regression after 7.32.0
Date: Thu, 20 Mar 2014 22:58:44 +0000
> -----Original Message-----
> From: curl-library [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of
> Daniel Stenberg
> Sent: Thursday, March 20, 2014 3:40 PM
>
> On Thu, 20 Mar 2014, Damian Lezama wrote:
>
> > I have an event oriented prototype that uses libuv and curl multi for
> > concurrent downloads. It is working fine with 7.32.0 but when I try
> > 7.35.0 the timer value is left at 0 and my program starts spinning.
>
> Can you clarify what this means? The timer value "is left at 0" ? What does it
> mean that the value is left? libcurl tells you a timeout, you tell it when it has
> expired.
[Damian] It means I received at some point a timeout callback with value 0, but
when I called curl_multi_perform, I received no timeout callback, so the timeout
value was "left" as 0. As I call curl_multi_perform and nothing happens, the timeout
value is still 0, so my loop doesn't wait, it calls again, and again... And this consumes
100% cpu.
> > When this happens, on each timer expiration I call into
> > curl_multi_socket_action and nothing happens, I don't get the timer
> > callback or any activity.
>
> I'm having a hard time understanding how this can happen on every timer
> expiration because then the logic must be completely broken and this is not a
> bug report I can recall we've seen before.
>
> I can't really tell you exactly what's happening here, but we probably need to
> instrument the libcurl internals and or do some debugger single-stepping to
> figure this out.
>
> If you fire off a timeout to libcurl _before_ libcurl thinks it should run, libcurl
> should call the timer callback again with a new expire time.
>
> If you fire off the timeout when libcurl thinks it has timeout work to do, then
> it should just process the necessary handles/sockets, call the suitable
> callbacks and go on with its job.
>
> Any chance you can dumb down the code as much as possible in order to get
> a recipe that is as simple as possible for me/us to try?
[Damian] Let me see what I can do. As I said my code works fine in 7.32.0, but
when trying 7.35.0 I enter in this cpu-hoging loop when I do not get the timeout
callback from curl_multi_perform. If curl_multi_perform did nothing, I'd expect it
to at least program the timer to something else, -1 for off or some reasonable
value for whatever is happening.
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-03-20