cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Race condition if server responds during POST

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 20 Feb 2014 10:02:03 +0100 (CET)

On Tue, 18 Feb 2014, Justin Karneges wrote:

> I've observed that if I POST some data to a server and the server responds
> before the data has been sent, then libcurl will receive the response but
> wait 10 seconds before indicating completion.

You use the term "Race" in the subject, is that because it doesn't always
happen or what makes it a race?

> Libcurl seems to recognize that a problem has happened ("stop sending"),
> gives me the response data (writeFunction called with 13 bytes), but then
> stalls. Eventually socketFunction is invoked to say the fd is no longer
> needed, and if I read messages after that then I get CURLMSG_DONE. I am able
> to reproduce this issue easily, and the delay is always around 10 seconds.
> Maybe the 10 second delay is a helpful hint about where to look inside
> libcurl?

There's no fixed 10 second timeout or delay anywhere so I don't think that
helps us a lot. The message "stop sending" is however only saying that libcurl
won't send any more, it will still receive the response. How do the response
look like in this case? I mean all the response headers etc. How does it
signal end of response?

You're using the multi_socket API right? I think this could be a mere
oversight somehow for that case.

Can you help me repeat this problem so I can check closer exactly what
happens there?

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-02-20