curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: PUT + CURLOPT_READFUNCTION + CLOSE_WAIT + AWS ELB on persistent requests

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 2 May 2017 16:17:50 +0200 (CEST)

On Wed, 26 Apr 2017, Mark Fine via curl-library wrote:

> I'm making a persistent PUT to a TCP AWS ELB - it's an endless request that
> is continuously sending data through a CURLOPT_READFUNCTION callback. During
> a deploy or some other event I lose connectivity to the AWS ELB and my
> socket enters CLOSE_WAIT - but my curl request continues to write data to
> the socket indefinitely.

Wow. How is that even possible? If there's no way to send the data I would
expect an error sooner or later to get returned from the send() calls libcurl
uses. It makes me curious where the data goes when it can't send it
anywhere...

> I have a CURLOPT_XFERINFOFUNCTION callback that also continues to report
> bytes uploaded!! How can I break out of this situation and end the request?

libcurl is supposed to detect errors and bail out. A closed connection should
cause such an error.

> In my callback should I see if the socket has gone into CLOSE_WAIT?

No, that's not exposed.

> Is it possible to do something better with the multi interface - I couldn't
> tell looking at the source code that it would behave any differently.

No, it's meant to work similarly fine using either interface!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-05-02