You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Pane <bp...@pacbell.net> on 2002/01/12 07:22:11 UTC

how to recreate the file descriptor segfault? Re: cvs commit: httpd-2.0 STATUS

I just tried to debug this with the current CVS HEAD on
Solaris, but I can't reproduce the crash.  The test case
that I tried was: set the httpd's ulimit on file descriptors
to a small number and run ab to generate enough concurrent
requests to exceed the fd limit.  Is there a better test case
that will trigger the segfault?

Thanks,
--Brian


Jeff Trawick wrote:

>brianp@apache.org writes:
>
>>brianp      02/01/11 00:07:07
>>
>>  Modified:    .        STATUS
>>  Log:
>>  Updated STATUS to cover the worker segfault fixes
>>  
>>
>
>>  -    * The worker MPM on Solaris segfaults when it runs out of file
>>  -      descriptors.  (This may affect other MPMs and/or platforms.)
>>
>
>I can still readily hit this on current code (the same code that no
>longer segfaults with graceful restart).
>
>[Fri Jan 11 07:26:37 2002] [error] (24)Too many open files:
>apr_accept: (client socket)
>[Fri Jan 11 07:26:37 2002] [error] [client 127.0.0.1] (24)Too many
>open files: file permissions deny server access: /exp
>ort/home/trawick/apacheinst/htdocs/index.html.en
>[Fri Jan 11 07:26:37 2002] [error] [client 127.0.0.1] (24)Too many
>open files: cannot access type map file: /export/home
>/trawick/apacheinst/error/HTTP_FORBIDDEN.html.var
>[Fri Jan 11 07:26:38 2002] [notice] child pid 25493 exit signal
>Segmentation fault (11), possible coredump in /export/ho
>me/trawick/apacheinst
>
>This is the same coredump I saw before:
>
>#0  0xff33a3cc in apr_wait_for_io_or_timeout (sock=0x738360,
> for_read=1) at sendrecv.c:70
>70              FD_SET(sock->socketdes, &fdset);
>
>The socket has already been closed so trying to set bit -1 segfaults.
>




Re: how to recreate the file descriptor segfault? Re: cvs commit: httpd-2.0 STATUS

Posted by Jeff Trawick <tr...@attglobal.net>.
Brian Pane <bp...@pacbell.net> writes:

> Thanks!  Using b instead of ab, I was able to make the error occur
> occasionally in my test environment.  I found one bug that could
> cause the previously accepted socket to be pushed back onto the
> fdqueue if an accept failed.  The change that I just committed
> for unixd.c fixes this.  I'm no longer seeing the segfault in my
> test environment, although that's not a guarantee that the bug is
> fixed, because I was only able to catch the error occasionally
> before the change.  With the latest unixd.c code, do you still
> see the segfaults in your environment?

You're rocking my world, Brian!

I first verified that I could easily hit segfaults on Solaris
repeating the same test (i.e., I didn't screw up my config in the
meantime), THEN I updated just unixd.c and started the same test, and
now she's running like a champ (with boatloads of errors from "Too
many open files" of course).

The bug you found would be terrible even with a properly tuned
server (connection reset between the kernel waking up Apache to do
accept() and accept() inside the kernel checking the queue).

-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Re: how to recreate the file descriptor segfault? Re: cvs commit: httpd-2.0 STATUS

Posted by Brian Pane <bp...@pacbell.net>.
Thanks!  Using b instead of ab, I was able to make the error occur
occasionally in my test environment.  I found one bug that could
cause the previously accepted socket to be pushed back onto the
fdqueue if an accept failed.  The change that I just committed
for unixd.c fixes this.  I'm no longer seeing the segfault in my
test environment, although that's not a guarantee that the bug is
fixed, because I was only able to catch the error occasionally
before the change.  With the latest unixd.c code, do you still
see the segfaults in your environment?

Thanks,
--Brian


Jeff Trawick wrote:

>Brian Pane <bp...@pacbell.net> writes:
>
>>I just tried to debug this with the current CVS HEAD on
>>Solaris, but I can't reproduce the crash.  The test case
>>that I tried was: set the httpd's ulimit on file descriptors
>>to a small number and run ab to generate enough concurrent
>>requests to exceed the fd limit.  Is there a better test case
>>that will trigger the segfault?
>>
>
>ulimit -n 100
>apachectl start
>
>from another shell with higher ulimit:
>
>b -n 100000 -c 200 127.0.0.1:8080/
>
>Note that / does a lot of negotiation work (extra file opens) using
>the default configuration.
>
>It didn't take more than a minute to hit a segfault.
>
>For some reason it seems easier to hit with my b than with standard ab
>(which should do pretty much the same thing with that command-line).
>
>b is at www.apache.org/~trawick/public_html/b.c
>
>To build it, "grep HAVE_ b.c" and see what to define on the cc
>invocation :)
>
>(I suspect I could hit it with ab if I were more patient.
>Historically b had better concurrency because it does non-blocking
>connects.  I don't know if 2.0 ab has been fixed to do non-blocking
>connects.)
>




Re: how to recreate the file descriptor segfault? Re: cvs commit: httpd-2.0 STATUS

Posted by Jeff Trawick <tr...@attglobal.net>.
Brian Pane <bp...@pacbell.net> writes:

> I just tried to debug this with the current CVS HEAD on
> Solaris, but I can't reproduce the crash.  The test case
> that I tried was: set the httpd's ulimit on file descriptors
> to a small number and run ab to generate enough concurrent
> requests to exceed the fd limit.  Is there a better test case
> that will trigger the segfault?

ulimit -n 100
apachectl start

from another shell with higher ulimit:

b -n 100000 -c 200 127.0.0.1:8080/

Note that / does a lot of negotiation work (extra file opens) using
the default configuration.

It didn't take more than a minute to hit a segfault.

For some reason it seems easier to hit with my b than with standard ab
(which should do pretty much the same thing with that command-line).

b is at www.apache.org/~trawick/public_html/b.c

To build it, "grep HAVE_ b.c" and see what to define on the cc
invocation :)

(I suspect I could hit it with ab if I were more patient.
Historically b had better concurrency because it does non-blocking
connects.  I don't know if 2.0 ab has been fixed to do non-blocking
connects.)
-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...