View Issue Details

IDProjectCategoryView StatusLast Update
0000658Apache 2.x Bugpublic2019-11-07 19:02
ReporterSteven LevineAssigned ToSteven Levine 
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
PlatformOS2/eCSOSOS/2 or eComstationOS Version1.x 2.x or 4.5
Product Version2.4.x 
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)

Steven Levine

2019-11-07 03:34

manager   ~0003373

It appears that we lost the ab.c patch somewhere along the way.

The attached diff is built against the 2.4.41 sources.

When you build, it would be helpful if you updated readme.os2 to mention the apr versions used for the builds.

ab.c-2.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-2.diff (1,476 bytes)

psmedley

2019-11-07 18:57

administrator   ~0003374

patching file support/ab.c
Hunk #1 FAILED at 634.
Hunk 0000002 FAILED at 675.
Hunk 0000003 succeeded at 2305 (offset 278 lines).
2 out of 3 hunks FAILED -- saving rejects to file support/ab.c.rej

I'll apply manually the 2x failed chunks....

psmedley

2019-11-07 19:02

administrator   ~0003375

http://smedley.id.au/tmp/httpd-2.4.41-os2-debug-20191107.zip

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
2019-11-07 03:25 Steven Levine Assigned To => Steven Levine
2019-11-07 03:25 Steven Levine Status new => assigned
2019-11-07 03:34 Steven Levine File Added: ab.c-2.diff
2019-11-07 03:34 Steven Levine Note Added: 0003373
2019-11-07 03:35 Steven Levine Product Version v2.2.29 => 2.4.x
2019-11-07 18:57 psmedley Note Added: 0003374
2019-11-07 19:02 psmedley Note Added: 0003375