hi Aaron,
I added in the "-r" command line options, to not exit out on
apr_socket_recv errors.
Patch attached
Filip
Aaron Bannert wrote:
Apache shouldn't be prematurely disconnecting sockets in the middle
of a response unless there is a serious problem (Eg. the Apache
child process is crashing). Could you describe how to reproduce this?
As for the patch, could you make this configurable with a command-line
option? That way the current functionality can stay default (meaning,
all recv() errors are fatal) and for those circumstances where the
user knows that there is some network-level or Apache-level problem
causing intermittent recv() errors, they can still get performance
results out of AB.
-aaron
Index: ab.c
===================================================================
--- ab.c (revision 511976)
+++ ab.c (working copy)
@@ -258,6 +258,7 @@
/* --------------------- GLOBALS ---------------------------- */
int verbosity = 0; /* no verbosity by default */
+int recverrok = 0;
int posting = 0; /* GET by default */
int requests = 1; /* Number of requests to make */
int heartbeatres = 100; /* How often do we say we're alive */
@@ -1330,9 +1331,19 @@
/* catch legitimate fatal apr_socket_recv errors */
else if (status != APR_SUCCESS) {
err_except++; /* XXX: is this the right error counter? */
- /* XXX: Should errors here be fatal, or should we allow a
- * certain number of them before completely failing? -aaron */
- apr_err("apr_socket_recv", status);
+ if ( recverrok ) {
+ bad++;
+ close_connection(c);
+ if ( verbosity >= 1 ) {
+ char buf[120];
+ fprintf(stderr,"%s: %s (%d)\n","apr_socket_recv",
apr_strerror(status, buf, sizeof buf), status);
+ }
+ return;
+ } else {
+ /* XXX: Should errors here be fatal, or should we allow a
+ * certain number of them before completely failing? -aaron */
+ apr_err("apr_socket_recv", status);
+ }
}
}
@@ -1819,6 +1830,7 @@
fprintf(stderr, " -S Do not show confidence estimators and
warnings.\n");
fprintf(stderr, " -g filename Output collected data to gnuplot
format file.\n");
fprintf(stderr, " -e filename Output CSV file with percentages
served\n");
+ fprintf(stderr, " -r Don't exit on apr_socket_recv
errors.\n");
fprintf(stderr, " -h Display usage information (this
message)\n");
#ifdef USE_SSL
fprintf(stderr, " -Z ciphersuite Specify SSL/TLS cipher suite (See
openssl ciphers)\n");
@@ -1981,7 +1993,7 @@
#endif
apr_getopt_init(&opt, cntxt, argc, argv);
- while ((status = apr_getopt(opt,
"n:c:t:b:T:p:v:kVhwix:y:z:C:H:P:A:g:X:de:Sq"
+ while ((status = apr_getopt(opt,
"n:c:t:b:T:p:v:rkVhwix:y:z:C:H:P:A:g:X:de:Sq"
#ifdef USE_SSL
"Z:f:"
#endif
@@ -2032,6 +2044,9 @@
exit(r);
}
break;
+ case 'r':
+ recverrok = 1;
+ break;
case 'v':
verbosity = atoi(optarg);
break;