Bug 55952 - ab: SSL keep-alive fails with apr_pollset_poll: The timeout specified has expired (70007)
Summary: ab: SSL keep-alive fails with apr_pollset_poll: The timeout specified has exp...
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: support (show other bugs)
Version: 2.5-HEAD
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-05 02:03 UTC by Kevin Locke
Modified: 2019-01-06 13:05 UTC (History)
0 users



Attachments
Example Node.js server which can be used to demonstrate the issue (5.74 KB, application/javascript)
2014-01-05 02:03 UTC, Kevin Locke
Details
Patch to print SSL_pending before apr_pollset_poll for debugging (719 bytes, patch)
2014-01-05 02:04 UTC, Kevin Locke
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Locke 2014-01-05 02:03:07 UTC
Created attachment 31169 [details]
Example Node.js server which can be used to demonstrate the issue

Running ab (from SVN r1555436) against a node.js HTTPS server running on localhost using keep-alive results in the following behavior:

$ ./ab -k -n 1 https://127.0.0.1:3443/test.txt
This is ApacheBench, Version 2.3 <$Revision: 1543020 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)...apr_pollset_poll: The timeout specified has expired (70007)

After some investigation, I believe the issue is that for large responses openssl may buffer some data and in the case that the server does not close the connection after sending the data (due to keep-alive) apr_pollset_poll has nothing to read and times out.  To test this hypothesis, I printed the value returned by SSL_pending before apr_pollset_poll which resulted in the following output:

$ ./ab -k -n 1 https://127.0.0.1:3443/test.txt
This is ApacheBench, Version 2.3 <$Revision: 1543020 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)...SSL_pending: 0
apr_pollset_poll complete
SSL_pending: 0
apr_pollset_poll complete
SSL_pending: 0
apr_pollset_poll complete
SSL_pending: 0
apr_pollset_poll complete
SSL_pending: 128
apr_pollset_poll: The timeout specified has expired (70007)

Which seems to support that hypothesis.  For completeness, I'll attach the node.js server that I used for testing as well as the patch with the additional debug information.

This issue may be related to Bug 22686, although that bug does not appear to be specific to SSL connections with keep-alive.

Cheers,
Kevin
Comment 1 Kevin Locke 2014-01-05 02:04:27 UTC
Created attachment 31170 [details]
Patch to print SSL_pending before apr_pollset_poll for debugging