You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Jim Cox <jc...@superlink.net> on 1999/08/09 21:06:54 UTC

test/4839: ApacheBench (ab) can perform more requests than specified on command line

>Number:         4839
>Category:       test
>Synopsis:       ApacheBench (ab) can perform more requests than specified on command line
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Mon Aug  9 12:10:01 PDT 1999
>Last-Modified:
>Originator:     jc@superlink.net
>Organization:
apache
>Release:        1.3_19990809131309 source
>Environment:
SunOS 5.6 Generic_105181-03 sparc
>Description:
When the call to connect() inside start_connect() doesn't block, a call to write_request()
is performed without checking that the number of 'done' requests is less than the requested
amount.
>How-To-Repeat:
Execute 'ab -n 1 -c 1' in a situation where the connect() call won't block (e.g. on the same
physical host as the web server) -- two requests will be made to the web server, although ab will
only report on one of them (because it abandons the socket after calling write_request() the
second time).
>Fix:
Either remove the call to write_request() in start_connect(), or check the
number of done requests before calling write_request(). Here's a diff for the first
option:

*** ab.c.baseline       Mon Aug  9 14:51:10 1999
--- ab.c        Mon Aug  9 14:51:04 1999
***************
*** 536,542 ****
      }
  
      /* connected first time */
!     write_request(c);
  }
  
  /* --------------------------------------------------------- */
--- 536,543 ----
      }
  
      /* connected first time */
!     c->state = STATE_CONNECTING;
!     FD_SET(c->fd, &writebits);
  }
  
  /* --------------------------------------------------------- */
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <ap...@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or      ]
["Re: general/1098:").  If the subject doesn't match this       ]
[pattern, your message will be misfiled and ignored.  The       ]
["apbugs" address is not added to the Cc line of messages from  ]
[the database automatically because of the potential for mail   ]
[loops.  If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request from a  ]
[developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]