curl / Mailing Lists / curl-library / Single Mail

curl-library

PUT + CURLOPT_READFUNCTION + CLOSE_WAIT + AWS ELB on persistent requests

From: Mark Fine via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 26 Apr 2017 19:11:41 -0700

Hi!

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. 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?

Here's my socket in CLOSE_WAIT:

root_at_piksi:/tmp # netstat -ta | grep ec2
tcp 0 0 10.1.22.85:54668
 ec2-52-88-203-144.us-west-2.compute.amazonaws.com:https CLOSE_WAIT
root_at_piksi:/tmp #

Here's a strace of my process, continuing to write to the socket:

clock_gettime(CLOCK_MONOTONIC, {1295, 375977280}) = 0
poll([{fd=14, events=POLLOUT|POLLWRNORM}], 1, 0) = 1 ([{fd=14,
revents=POLLOUT|POLLWRNORM}])
read(3, "U\n\2\351S\"\2109\235\24J\334\314\f\2\343B_at_S\2137\350\273\232^\300c\300\365\313\222\326"...,
16372) = 42
write(14,
"\27\3\3\0Ho\255\250Z7\346\273\375\2233]\344p\232\307\250(\243\1\214\252\271\327\20c\253\31"...,
77) = 77
clock_gettime(CLOCK_MONOTONIC, {1296, 174181364}) = 0

I've tried a number of things and various options but am not having any
luck. Has anyone run into this issue? Are there any workarounds? In my
callback should I see if the socket has gone into CLOSE_WAIT? 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.

Thanks for any help!

Mark

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