Date: Mon, 5 May 1997 23:25:26 -0600 (MDT) From: Marc Slemko <marcs@znep.com> To: Scott Halbert <thor@thuntek.net> Cc: freebsd-isp@FreeBSD.ORG Subject: Re: Apache Socket Starvation Bug in 1.2 Message-ID: <Pine.BSF.3.95.970505225642.28449A-100000@alive.znep.com> In-Reply-To: <3.0.32.19970505212008.01103168@thuntek.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 5 May 1997, Scott Halbert wrote: > Is anyone familiar with the problems with Apache versions 1.2 with socket > starvation? The problem manifests itself as the server locking itself up > and clients hanging with "waiting for reply". For me a KILL -HUP will get > things going again. > > To quote the apacheweek article, "This problem only affects systems which > do not define USE_FLOCK_SERIALIZED_ACCEPT or USE_FCNTL_SERIALIZED_ACCEPT > in conf.h (this includes SunOS 4, FreeBSD, BSDI and some others)." > > Here are some URLS documenting the bug: > > http://www.apache.org/bugdb.cgi/full/467 > http://www.apacheweek.com/issues/97-04-25 > > My problem is that the Apache workaround does not work for me. Turning > on USE_FLOCK_SERIALIZED_ACCEPT does not help and USE_FCNTL_SERIALIZED_ACCEPT > hangs the server immediately. What version of FreeBSD are you using? You may not have a /usr/tmp and Apache is braindead and just uses /usr/tmp Try changing the: strncpy(lock_fname, "/usr/tmp/htlock.XXXXXX", sizeof(lock_fname)-1); lines (note there are two; one is compiled for USE_FLOCK_SERIALIZED_ACCEPT, one for USE_FCNTL_SERIALIZED_ACCEPT) to reference /var/tmp. This is a bad thing that I have been meaning to get around to fix, but didn't get around to it. Grr. The reason why the FCNTL doesn't work is a bug caused by someone being lazy. Fixed it somewhere else but guess not there... The patch included at the end of this message should fix that one; should apply cleanly against 1.2b10, but I haven't tried. > It sure seems to me that I've got something unique in my configuration. > If this happened to all apache 1.2 servers under FreeBSD, I'd hear this > group freaking out. I daresay that a very high majority of FreeBSD ISPs > use Apache. Maybe some of you have seen it and were in the same boat? > > This problem is upsetting my customers and making me pull my hair out. > > Maybe this is not exactly the bug I'm chasing, though it sure looks like > it. Maybe I've got my timeouts and idles messed up in my configuration > file. Are you using multiple Listen directives? That is the only case where the bug you refer to above shows up. Are you sure you aren't running into processes per uid or file descriptor limits? If your config file isn't overly complex, try it with as close to the distributed config file as possible. How much traffic does your site see? How many virtual hosts does it have? How often does the problem happen? When it happens, do a ps to see how many child processes there are (ie. not the one running as root, but the ones that serve requests as whatever your User directive is set to). Do a ktrace (eg. ktrace -p 1234) on a child and see where it is hanging. If that fails, compile with -g and attach gdb to a child process and see where it is hanging. If the child is blocked waiting for a lock, then it could be the problem you mention above. Rest assured that this problem does _not_ happen all the time. Many of the developers (including me) use FreeBSD both for development and production machines pushing high volumes of traffic. Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache/src/http_main.c,v retrieving revision 1.142 diff -c -r1.142 http_main.c *** http_main.c 1997/04/29 02:39:01 1.142 --- http_main.c 1997/05/06 05:16:53 *************** *** 191,198 **** #endif #if defined(USE_FCNTL_SERIALIZED_ACCEPT) ! static struct flock lock_it = { F_WRLCK, 0, 0, 0 }; ! static struct flock unlock_it = { F_UNLCK, 0, 0, 0 }; static int lock_fd=-1; --- 191,198 ---- #endif #if defined(USE_FCNTL_SERIALIZED_ACCEPT) ! static struct flock lock_it; ! static struct flock unlock_it; static int lock_fd=-1; *************** *** 204,209 **** --- 204,220 ---- accept_mutex_init(pool *p) { char lock_fname[256]; + + lock_it.l_whence = SEEK_SET; /* from current point */ + lock_it.l_start = 0; /* -"- */ + lock_it.l_len = 0; /* until end of file */ + lock_it.l_type = F_WRLCK; /* set exclusive/write lock */ + lock_it.l_pid = 0; /* pid not actually interesting */ + unlock_it.l_whence = SEEK_SET; /* from current point */ + unlock_it.l_start = 0; /* -"- */ + unlock_it.l_len = 0; /* until end of file */ + unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */ + unlock_it.l_pid = 0; /* pid not actually interesting */ #ifdef __MACHTEN__ strncpy(lock_fname, "/var/tmp/htlock.XXXXXX", sizeof(lock_fname)-1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.970505225642.28449A-100000>