apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Reitzel <creit...@rcn.com>
Subject RE: Patch for unix/poll.c (!HAVE_POLL)
Date Thu, 26 Sep 2002 20:04:57 GMT
Thanks for looking.  Sorry, don't have -u on my diff (an older MKS version).

Instead, I have attached the entire file poll.c so you can diff it easily 
the way you want.  Sorry if this is overkill.  The modified section (+ 
comments) is below.

The section in question is the loop over the fd_set after returning from 
select().  Only return APR_EBADF if the desc_type == APR_POLL_FILE and 
quietly pass over APR_NO_DESC.  Currently, anything not set APR_POLL_SOCKET 
is an error.  ab.exe will use the fixed set of sockets, even after closing 
some of them at the end of testing.  Not sure what poll() behavior should 
be exactly in this case, however.  My guess is this matches, as I suspect 
ab works fine on platforms w/ poll().

take it easy,
Charlie

srclib/apr/poll/unix/poll.c, Line 284:

     for (i = 0; i < num; i++) {
         apr_os_sock_t fd;

         aprset[i].rtnevents = 0; /* Always clear out the events */

         if (aprset[i].desc_type == APR_POLL_SOCKET) {
             fd = aprset[i].desc.s->socketdes;
         }
         else  if (aprset[i].desc_type == APR_POLL_FILE) {
#if APR_FILES_AS_SOCKETS
             fd = aprset[i].desc.f->filedes;
#else
             /* Only error out if type explicitly set to APR_POLL_FILE */
             return APR_EBADF;
#endif
         }
         else if (aprset[i].desc_type == APR_NO_DESC) {
             /* Non-sockets in the array are a no-op */
             continue;
         }

         if (FD_ISSET(fd, &readset)) {
             aprset[i].rtnevents |= APR_POLLIN;
         }
         if (FD_ISSET(fd, &writeset)) {
             aprset[i].rtnevents |= APR_POLLOUT;
         }
         if (FD_ISSET(fd, &exceptset)) {
             aprset[i].rtnevents |= APR_POLLERR;
         }
     }

     return APR_SUCCESS;
}

At 02:50 PM 9/26/2002 -0400, Bill Stoddard wrote:

>I cannot understand your patch. Please submit as a unified diff and make
>sure you are using the most recent version of APR.
>
>Thanks,
>Bill
>
> >
> > On Win2K, I was having a consistent problem with ab in the last N
> > iterations with concurrency N.  For example, running "ab -n 20 -c 10
> > http://example.com/foo" would consistently cause a poll error out
> > after 13 or 15 requests.  The message (errno == 9) was that poll
> > was passed something that is not a socket.
> >
> > Anyway, I tracked down the problem to the post-select handling.
> > It doesn't quite match the pre-select handling.  The attached
> > patch makes it so.  This patch is not platform-specific, but
> > obviously only affects platforms w/out poll().
> >
> > take it easy,
> > Charlie

Mime
View raw message