View Issue Details

IDProjectCategoryView StatusLast Update
0000658Apache 2.2.x for OS/2 & eComStationBugpublic2015-11-11 12:11
ReporterSteven LevineAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformOS2/eCSOSOS/2 or eComstationOS Version1.x 2.x or 4.5
Product Versionv2.2.29 
Target VersionFixed in Version 
Summary0000658: ab.exe fails when accessing site over the WAN
DescriptionWhile doing some ab stress testing I discovered that ab seems to always
fail when accessing sites over the WAN. I never noticed this before
because all my previous work with ab was done over LAN connections.

A bit of time with the debugger identified the issue, which appears to be
a tcp/ip stack defect. The attached patch should avoid the error.
Steps To ReproduceYou should be able to see the failure and verify the patch with:

  ab -c1 -n1 http://smedley.info/
TagsNo tags attached.

Activities

Steven Levine

2015-11-11 12:11

manager  

ab.c.diff (1,476 bytes)
diff --git a/support/ab.c b/support/ab.c
index 25fc0e0..fb6f364 100644
--- a/support/ab.c
+++ b/support/ab.c
@@ -634,6 +634,8 @@ static void ssl_proceed_handshake(struct connection *c)
 
 static void write_request(struct connection * c)
 {
+    int connect_retries = 0;
+
     do {
         apr_time_t tnow;
         apr_size_t l = c->rwrite;
@@ -675,6 +677,18 @@ static void write_request(struct connection * c)
 #endif
             e = apr_socket_send(c->aprsock, request + c->rwrote, &l);
 
+        /* 2015-11-01 SHL Avoid apparent tcp/ip stack defect
+           Connecting to a remote host is slow in the sense that the 1st write
+           after connect can fail with SOCENOTCONN, which is spurious
+           The retries avoid the spurious errors
+        */
+        if (e == APR_FROM_OS_ERROR(SOCENOTCONN) &&
+            c->rwrote == 0 &&
+            ++connect_retries <= 5) {
+          apr_sleep(apr_time_from_msec(10));
+          continue;
+        }
+
         if (e != APR_SUCCESS && !APR_STATUS_IS_EAGAIN(e)) {
             epipe++;
             printf("Send request failed!\n");
@@ -2027,6 +2041,11 @@ int main(int argc, const char * const argv[])
     AB_SSL_METHOD_CONST SSL_METHOD *meth = SSLv23_client_method();
 #endif
 
+#   ifdef OS2                           /* 2014-12-29 SHL want text output for OS2 */
+    _fsetmode(stdout, "t");
+    _fsetmode(stderr, "t");
+#   endif
+
     /* table defaults  */
     tablestring = "";
     trstring = "";
ab.c.diff (1,476 bytes)

Issue History

Date Modified Username Field Change
2015-11-11 12:11 Steven Levine New Issue
2015-11-11 12:11 Steven Levine File Added: ab.c.diff