cURL / Mailing Lists / curl-library / Single Mail


RE: curl_multi_perform call blocked infinitely when netowrk is disconnected

From: Daniel Stenberg <>
Date: Sat, 21 Jan 2012 17:12:15 +0100 (CET)

On Fri, 20 Jan 2012, Ajay Poppur Suresh wrote:

> When the curl_multi_perform call is made ( that is after the select call in
> the below sample code), and then the network cable is disconnected, the call
> to curl_multi_perform does not return and infinetly loops.

Can you try to write up a test case that repeats the problem? It is clearly so
that in some situations libcurl is waiting in a blocking manner for a response
and we should fix that.

We've seen it reported before on the final "quit" command that is used for
SMTP, POP3 and IMAP immediately the connection is to get closed.

> The outer while(still_running) loop continuously looping for ever.

But isn't this because the connection is still there? That's not actually a
bug if so.

> Can we do something from client end here to terminate gracefully when there
> is no network connection?

In this second case you can just remove the handle when you're done. In TCP
terms the "no network connection" is not detected so there's nothing wrong.
You can enable TCP keepalives to track it, you can use a timeout or you can
use libcurl's low speed triggers.

List admin:
Received on 2012-01-21