Thank you for the quick reply, and apologies for my less-than-clear
message: let me give more details.
I am poll-ing with a timeout of 60 seconds, and SSL_write is
returning a positive number of bytes read each time through (we
always find data well before the timeout). The server logs for the
part of the session with the 50ms delay look like this:
2007-07-26 20:18:04.375 [3317] GS: Got response from sendDataPending
2007-07-26 20:18:04.376 [3317] GS: Calling poll with timeout 60000
2007-07-26 20:18:04.376 [3317] GS: Checking poll results
2007-07-26 20:18:04.376 [3317] GS: calling SSL_write on buffer of
length 1281
2007-07-26 20:18:04.376 [3317] GS: done with SSL_write
2007-07-26 20:18:04.376 [3317] Called advanceSendBuffer:len
2007-07-26 20:18:04.377 [3317] GS: Calling poll with timeout 60000
2007-07-26 20:18:04.426 [3317] GS: Checking poll
results <------------- 50ms delay occurs here
2007-07-26 20:18:04.426 [3317] GS: calling SSL_read
2007-07-26 20:18:04.427 [3317] GS: done with SSL_read, len = 142,
text = GET
The sendDataPending function tells us that we have more data to
send. In the first "calling poll" iteration above, we're calling
poll for both read and write. In the second call to poll, we're only
polling for readability, having sent our entire data buffer, so this
is the point where we are awaiting more data.
The client code (Objective-C) is:
NSLog(@"DEBUG: 2");
if( curl_easy_perform(myhandle) == 0 ) {
NSLog(@"DEBUG: 3");
I enabled libcurl's verbose mode in the client, and it recorded this
transaction as follows (timestamps should match, since it's the same
machine):
2007-07-26 20:18:04.363 fpbridge[21199] DEBUG: 2
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 8443
> GET /filename HTTP/1.1
Host: 127.0.0.1:8443
Pragma: no-cache
Accept: */*
< HTTP/1.1 200 OK
< Content-type: application/x-troff; charset=utf-8
< Content-length: 1281
* Connection #0 to host 127.0.0.1 left intact
2007-07-26 20:18:04.413 fpbridge[21199] DEBUG: 3
In other words, the server's final SSL_write happens at 20:18:04.376,
but the client does not return from curl_easy_perform until
20:18:04.413. My question is: why would it take so long to transfer
that 1281 bytes of data between two processes on the same machine,
even when I'm reusing the same SSL connection? What happens between
the call to SSL_write and the point where the client receives the 200
OK message? The error may of course be on the client side, but I
just wanted to see if there is any debugging I could do on my
SSL_write call.
Thank you!
On Jul 26, 2007, at 3:38 PM, David Schwartz wrote:
I have a Linux server application that calls SSL_write in a loop, and
polls the underlying socket using the poll(2) system call. In the
loop, the first few calls to poll return immediately with data on the
socket, but I'm finding that the last call to poll always takes about
50ms to before poll returns. I am setting O_NONBLOCK on the socket
using fcntl when I first initialize it, so I know it's in non-
blocking mode. Is there anything else that could cause a poll not to
immediately find readable data on a socket to which I've written
using SSL_write? Note that I confirmed via log message that the
SSL_write operation completes before I call poll.
It's hard to understand your issue. You don't tell us if you're
'poll'ing
just for readability and what response you got from SSL_write. You
don't
tell us what timeout you pass to 'poll'. So this response includes
a lot of
guessing.
Presumably, 'poll' is not returning because there is no data.
Presumably
there is no data because to other side hasn't sent any. This could be
because the other side isn't supposed to (for example, it may be
waiting for
the other side to send protocol data) or it could be because there's a
problem with the other side.
DS
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]