cURL / Mailing Lists / curl-library / Single Mail


RE: curl_multi_perform call blocked infinitely when netowrk is disconnected

From: Daniel Stenberg <>
Date: Sat, 28 Jan 2012 13:56:35 +0100 (CET)

On Tue, 24 Jan 2012, Ajay Poppur Suresh wrote:

> Please try to execute libcurl/docs/examples/multi-app.c Provide a large file
> ( example: 120 MB) and connected to a very slow server. While transfer is in
> progress, disconnect the network cable and you will be able to recreate the
> issue.

First, please don't top-post.

You're simplifying the case too much. Please try to be more exact and please
try to give us a programmatic way to repeat the problem, I very rarely want to
actually yank the cable of my development machines.

*While transferring* the body of an FTP file there's nothing waiting for a
response and nothing drives the FTP state machine in libcurl so thus that
cannot be the situation where it hangs in the state machine. If it hangs in
this situation (in the middle of the file transfer), can you tell us exactly
where in the code libcurl is then?

It can of course not complete the transfer while it thinks the transfer is
still going on and just being very very slow (which yanking the cable often is
the equivalent of) and that's something you can redeem yourself by using a
timeout or just removing the handle when you think is fit.

If the problem happens _after_ the slow transfer (which you didn't say), then
it might be so that the control connection has died and libcurl hasn't spotted
that and it sits waiting for a response from the server that won't arrive.

Both of these problems can be slightly improved by enabling TCP keepalive on
the connections, which libcurl currently doesn't do by its own (but might
soon, see Dave Reisner's recent patch).

List admin:
Received on 2012-01-28