cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Multiple connects to the same HTTP(S) server

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 19 Feb 2006 20:11:13 +0100 (CET)

On Mon, 20 Feb 2006, Nimrod A. Abing wrote:

> Now this setup seems to work fine in most cases. I am able to do several
> uploads at once as long as *none* of those transfers take a lot of time to
> finish. The problem is that if an upload is waiting for a response from the
> server, other uploads/downloads seem to be blocked. I don't know much about
> curl internals but I thought curl_multi_perform() is *not* supposed to block
> even though one of those transfers is waiting for a response from the
> server.

Yes, that is the purpose of the multi interface. It isn't 100% non-blocking
though, and it also varies depending on what sub-library support your libcurl
is built to use.

The blocking parts are of course meant to get fixed, and they are in fact at
least better these days than they used to be.

> I am able to reproduce the problem consistently. First I upload a file and
> wait for it to be uploaded, it will cause the server to take some time to
> respond. Then I try to do a second upload or even just a "server ping"
> (which is just an HTTP request to a special URL on the server). The app will
> then hang up seemingly waiting for the first request to finish with a reply
> from the server.
>
> I have tried even using threads with this, running the queue in a separate
> thread. Initially I tried multithreaded easy handles with curl_easy_perform.
> Same results, which is why I swiched to the multiplexing interface. I even
> have the following setopt calls for each new handle I create:

To be honest, since you've tried multiple approaches and still get the same
sympthoms and since I know that libcurl doesn't have any blocking in this kind
of approach, I would blame the server end. The server is clearly not properly
responding or reacting when you communicate with it while it is in progress
taking care of the previous upload.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-02-19