Darwin SSL issue - missing bytes
Date: Fri, 8 Feb 2013 15:46:49 +0000
Ran into another Darwin SSL issue, this time it's the exact opposite of last one; not all bytes are being sent. It's also a far more elusive bug, harder to consistently replicate.
As I was moving BBHTTP (an Objective-C wrapper for CURL) into a beta version of Droplr for iPhone, I began receiving reports, mainly from folks with iPhone 5's (armv7s) that uploads kept timing out waiting for responses. On a 3GS and 4S (armv7) I can only reproduce this on a 3G network but the 5's seem to suffer from this on almost every upload, 3G, WiFi or LTE.
Droplr being an upload intensive service, I already had plenty of logging in place to detect client errors. Launched an HTTPS Amazon load balancer in front of the sandbox server, turned up the volume on the logs and discovered that the timeout was due to the server not receiving the total payload announced by the client (and thus not responding in the appropriate time frame).
libcurl's verbose logging says "We are completely uploaded and fine" but the server always reports some bytes missing -- the amount of bytes missing always matches the number of bytes of the last chunk curl reports as being sent.
Here's an excerpt of both logs:
2013-02-08 14:32:18.777 App[24330:5953] BBHTTP | CURL | DATA OUT >> 3787b
2013-02-08 14:32:18.780 App[24330:5953] BBHTTP | CURL | We are completely uploaded and fine
2013-02-08 14:32:38.809 App[24330:5953] BBHTTP | CURL | Operation too slow. Less than 1024 bytes/sec transferred the last 15 seconds
2013-02-08 14:32:55|INFO |POST /xxxx: Timed out waiting for content:
- expecting: 2150091b (~2MB)
- received: 2146304b (~2MB)
- missing from client: 3787 (~4KB)
I've confirmed that this only happens with HTTPS connections; HTTP connections work flawlessly, no matter the phone and network conditions.
(On these logs, the server's clock is ~15 seconds ahead of the client.)
I'll try to understand what's going on but any directions would be highly appreciated.
List admin: http://cool.haxx.se/list/listinfo/curl-library
Received on 2013-02-08