You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2007/07/06 23:45:17 UTC

DO NOT REPLY [Bug 42829] New: - graceful restart with multiple listeners using prefork MPM can result in hung processes on FreeBSD

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829

           Summary: graceful restart with multiple listeners using prefork
                    MPM can result in hung processes on FreeBSD
           Product: Apache httpd-2
           Version: 2.2.4
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Keywords: PatchAvailable
          Severity: normal
          Priority: P2
         Component: prefork
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: nmower@verio.net


Intermittently after a graceful restart (apachectl graceful) extra Apache
processes are left running on the server.  A check to server-status shows a
number of them to be in state 'G' (gracefully finishing).  They remain in that
state indefinitely, and will not go away until a stop-and-start or a restart is
issued.

The 'top' command shows one of these 'G' processes is stuck in kqread, while the
rest are in lockf.  (I believe the processes in lockf are blocking on the accept
mutex, which is held by the process in kqread and therefore is never cleared.)

A stack trace of the process in kqread state shows the process calling kevent()
from the apr_pollset_poll() function in srclib/apr/poll/unix/kqueue.c, which is
called from the main loop in child_main() of server/mpm/prefork/profork.c.  When
the process is allowed to  continue, it never returns from kevent().

Frequently the error log contains the following message when the problem has
occurred:
[error] (9)Bad file descriptor: apr_socket_accept: (client socket)

The behavior can be replicated in the Apache 2.2.4 release version on FreeBSD
6.2 stable.  The build configuration is as follows:

./configure \
  --with-apr=/usr/local/apr-httpd/ \
  --with-apr-util=/usr/local/apr-util-httpd/ \
  --prefix=/usr/local/httpd-2.2.4 \
  --with-mpm=prefork \
  --enable-mods=info

The problem only occurs when at least one extra listener is configured in
httpd.conf:
  Listen 80
  Listen 8080

When replicating the problem it is useful to enable server-status by
uncommenting the Include line for httpd-info.conf and adding an 'Allow from'
line in the file conf/extra/httpd-info.conf.

After Apache has been restarted a series of 'apachectl graceful' commands will
usually trigger the problem.  It speeds things up to run several of them on one
command line (separated by semi-colons), but care is required not to run into
another Apache bug with similar steps to duplicate (ID 39311).  Usually the hung
'G' process will show up within 2-3 minutes by continually repeating in this way.

Here is my take on what may happening, along with a patch that works for me:

There appears to be a race condition between Apache prefork and kevent() that
depends upon the timing of the receipt of SIGUSR1 in the child process.  When
SIGUSR1 is received, the current signal handler for prefork closes all listeners
immediately.  I believe if the close occurs before the process gets into
kevent() to poll the sockets, it can cause kevent() to hang.

My solution was to wait until after the !die_now loop to close listeners.  The
signal handler merely sets the die_now flag, nothing more.  Here is my proposed
patch:

--- prefork.c.orig      Fri Jul  6 11:12:53 2007
+++ prefork.c   Fri Jul  6 11:18:24 2007
@@ -330,8 +330,6 @@
 
 static void stop_listening(int sig)
 {
-    ap_close_listeners();
-
     /* For a graceful stop, we want the child to exit when done */
     die_now = 1;
 }
@@ -657,6 +655,7 @@
             die_now = 1;
         }
     }
+    ap_close_listeners();
     clean_child_exit(0);
 }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From paulhen@4hens.org  2008-01-04 05:25 -------
> More and more processes ended up hung until we reached
> our MaxClients limit, resulting in denial of service.

Denial of service is also resulting from the memory 
occupied by the hung processes. This has been severe 
enough to cause to cause errors such as 
"/libexec/ld-elf.so.1: /lib/libc.so.6: mmap of entire address space failed:
Cannot allocate memory."
when attempting to connect via ssh. 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829


nmower@verio.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|graceful restart with       |graceful restart with
                   |multiple listeners using    |multiple listeners using
                   |prefork MPM can result in   |prefork MPM can result in
                   |hung processes on FreeBSD   |hung processes




------- Additional Comments From nmower@verio.net  2007-09-26 09:53 -------
(In reply to comment #7)

> what are the implications of this, could any problems arise if this is not 
> patched ?

It caused us problems in cases where a cron entry was saving off log files and
then issuing a graceful restart every night.  More and more processes ended up
hung until we reached our MaxClients limit, resulting in denial of service.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes on FreeBSD

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829


apache-bugzilla@krustev.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |apache-bugzilla@krustev.net




------- Additional Comments From apache-bugzilla@krustev.net  2007-09-05 07:50 -------
I'm also seeing this on Debian testing on x86 . 

Looking at the error logs the problem has appeared  before 2.2.4. I see the 
message:

[Fri Nov 24 09:25:09 2006] [notice] Graceful restart requested, doing restart
[Fri Nov 24 09:25:09 2006] [error] (9)Bad file descriptor: apr_socket_accept: 
(client socket)
[Fri Nov 24 09:25:23 2006] [notice] Apache configured -- resuming normal 
operations


At this time the apache version on testing was 2.2.3 (so was on this box)

Recently, after the upgrade to 2.2.4 and the fix to CVE-2007-3304 I'm also 
seeing this:

[Thu Aug 23 13:00:14 2007] [notice] Graceful restart requested, doing restart
[Thu Aug 23 13:00:14 2007] [notice] (10)No child processes: cannot send signal 
10 to pid 19020 (non-child or already dead)
[Thu Aug 23 13:00:14 2007] [error] (9)Bad file descriptor: apr_socket_accept: 
(client socket)
[Thu Aug 23 13:00:17 2007] [notice] Digest: generating secret for digest 
authentication ...
[Thu Aug 23 13:00:21 2007] [notice] Digest: done
[Thu Aug 23 13:00:21 2007] [notice] Apache/2.2.4 (Debian) mod_ssl/2.2.4 
OpenSSL/0.9.8e DAV/2 configured -- resuming normal operations


I've noticed that after such unsuccessfull gracefull restart the number of the 
remaining alive children stands almost constant(about 32-33, I've got 
MinSpareServers set to 30). I've started 200 parallel requests for a big file, 
but the number of the active children remained about 30, although I've got 
MaxClients set to 256.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From jorton@redhat.com  2008-01-18 07:54 -------
Ah, sorry, I missed that, thanks Stefan.  The dup2 is actually simple in
implementation, I'll attach a patch.  I don't think it is necessary to worry
about invalidating the pollsets -- the pollsets will contain references *to the
listening fds*.  So I think that simply dup2ing onto those fds should be sufficient.

I'm not sure which approach is better/safer.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829


sf@sfritsch.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #21002|0                           |1
        is obsolete|                            |




------- Additional Comments From sf@sfritsch.de  2007-11-16 02:06 -------
Created an attachment (id=21137)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=21137&action=view)
patch for graceful-stop / graceful reload problem without race condition

This patch fixes the remaining race condition in the previous patch

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From jorton@redhat.com  2008-01-18 15:10 -------
Taking this up dev@httpd.

http://marc.info/?l=apache-httpd-dev&m=120069757111682&w=2

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829


sf@sfritsch.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #20470|0                           |1
        is obsolete|                            |




------- Additional Comments From sf@sfritsch.de  2007-10-18 05:43 -------
Created an attachment (id=21002)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=21002&action=view)
new patch for graceful-stop / graceful reload problem


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829


rpluem@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




------- Additional Comments From rpluem@apache.org  2008-01-18 14:09 -------
(In reply to comment #20)
> Created an attachment (id=21406)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=21406&action=view) [edit]
> close listeners using dup2 to avoid undefined behaviour
> 
> This closes the listeners by dup2'ing a dummy socket onto them.  This should
> restore the guarantee of defined behaviour by a call to
> accept/apr_pollset_poll/ which references this fd, as opposed to closing it
> outright.

Hm, and apr_pollset_poll called on the dummy_listener with APR_POLLIN as event
for which we are looking for returns immediately?


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes on FreeBSD

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From rich@hq.vsaa.lv  2007-09-25 03:36 -------
the same problem on sles 10 sp1 (using 2.2.3).

what are the implications of this, could any problems arise if this is not 
patched ?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes on FreeBSD

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From oeriksson@mandriva.com  2007-09-12 05:52 -------
Confirmed on Mandriva Linux Cooker as well with 2.2.6. The proposed patch seems
to fix this.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From jorton@redhat.com  2008-01-18 06:45 -------
So, am I correct in the assumption that the root cause of this bug is a sequence
as follows:

1. child in child_main enters the while (!die_now) loop
2. child is SIGUSR1'ed
3. listening socket, fd N is close()d
4. child calls accept or epoll_wait/whatever *on closed fd N*

and calling accept/epoll_wait/whatever on a closed fd results in undefined
behaviour and hence the process may hang.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes on FreeBSD

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829


rich@hq.vsaa.lv changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rich@hq.vsaa.lv




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From sf@sfritsch.de  2007-10-18 05:41 -------
The patch from the bug submitter does not close the listening sockets until the
current request has been finished, therefore breaking graceful-stop behaviour.

Depending on OS and used apr_pollset_poll variant, it seems that both
apr_pollset_poll() and lr->accept_func() can block if the sockets have been
closed in the meantime. This can be mitigated by checking for die_now before
calling these two functions (though a short race condition still remains).

Maybe it would also be possible to change apr to not block if all listening
sockets in the pollset are closed.



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes on FreeBSD

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From ilya.glazkov@gmail.com  2007-08-28 03:52 -------
Same problem on Apache 2.2.4 (Debian/Lenny, amd x86_64, kernel 2.6.18)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829


nmower@verio.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From sf@sfritsch.de  2007-11-15 10:58 -------
(In reply to comment #12)
> it seems this bug may be related to similar issues for the event mpm?
> PR 43359:
> http://issues.apache.org/bugzilla/show_bug.cgi?id=43359
> 
> Has a more complicated patch...

I think that's a different bug. Here, calling apr_pollset_poll and/or accept 
when the listening sockets have already been closed, causing a block. In 
PR43359 not continuing to process the request when the listening sockets have 
been closed.

I don't see how the patch from PR43359 would help in prefork, as we have to 
close the sockets in the signal handler (at least when we are in 
ap_process_connection). Otherwise the sockets will only be closed after the 
current request is finished, which would break graceful stop.

Or am I missing something?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From jorton@redhat.com  2008-01-18 07:57 -------
Created an attachment (id=21406)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=21406&action=view)
close listeners using dup2 to avoid undefined behaviour

This closes the listeners by dup2'ing a dummy socket onto them.  This should
restore the guarantee of defined behaviour by a call to
accept/apr_pollset_poll/ which references this fd, as opposed to closing it
outright.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From jorton@redhat.com  2008-01-18 09:14 -------
Using dup2 like this does have the advantage that it makes stop_listening()
(more) async-signal-safe; calling apr_socket_close(), as the current code does,
is particularly async-signal-unsafe since it modifies pool state.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From jorton@redhat.com  2008-01-18 07:00 -------
Presuming the assumption above is correct; Stefan's patch doesn't strictly close
the race since the signal could still occur e.g. between checking die_now and
the invocation of the accept function.

To strictly close this race, I think ap_close_listeners() is going to have to
dup  something on to the listening fds which will guarantee that the accept/etc
function call has defined behaviour.   In the single-listener case this could be
a simple hack like dup2(open("/dev/null", blah), listener).  For the
multi-listener case, it means invalidating the pollset fd, which is
method-specific and will require a new APR interface.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829


dlr@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlr@apache.org




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From sf@sfritsch.de  2008-01-18 07:17 -------
Joe's description of the problem in comment #16 is accurate.

I think I closed the race completely, because if the signal occurs between the 
check for die_now and accept(), the signal handler will only set die_now and 
not call ap_close_listeners() (because active_connection == 0). In this case 
the ap_close_listeners() is done in the while loop just before 
ap_process_connection().

But fixing it in apr, so that apr_pollset_poll, etc. have a defined behaviour 
would probably be better.

Maybe 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes on FreeBSD

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From mihai.costache@freeland.ro  2007-08-23 09:50 -------
i have same issue on my test/preproduction machine with apache 2.2.4 (with
mod_ssl, mod_php) on top of gentoo 2007.0 and slackware 12.0 linux distribution
...  tested with the package from distribution and with my own package builded
from vanilla apache (the arhives from httpd.apache.org)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes on FreeBSD

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From henkka@spheroid.fi  2007-08-22 01:33 -------
I have the exactly same problem on jailed Apache 2.2.4 running on FreeBSD 6.2.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829


axelseaa@modevia.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |axelseaa@modevia.com




------- Additional Comments From axelseaa@modevia.com  2007-09-27 07:21 -------
We are running sles 10 and also getting the following:

[Wed Sep 26 03:00:02 2007] [notice] Graceful restart requested, doing restart
[Wed Sep 26 03:00:02 2007] [error] (9)Bad file descriptor: apr_socket_accept:
(client socket)
[Wed Sep 26 03:00:02 2007] [error] (9)Bad file descriptor: apr_socket_accept:
(client socket)
Syntax error on line 101 of /etc/apache2/server-tuning.conf:
Invalid command 'BrowserMatch', perhaps misspelled or defined by a module not
included in the server configuration
[Wed Sep 26 03:10:02 2007] [warn] pid file /var/run/httpd2.pid overwritten --
Unclean shutdown of previous Apache run?
[Wed Sep 26 03:10:02 2007] [notice] Apache/2.2.3 (Linux/SUSE) configured --
resuming normal operations

It doesn't happen every night, very sporadically.

For the mean time, I have a script that checks to make sure apache is running,
and if not, restart it.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes on FreeBSD

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From nmower@verio.net  2007-07-06 14:48 -------
Created an attachment (id=20470)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20470&action=view)
Proposed changes to the SIGUSR1 handler and prefork code


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829


sf@sfritsch.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sf@sfritsch.de




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 42829] - graceful restart with multiple listeners using prefork MPM can result in hung processes

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42829





------- Additional Comments From chip@force-elite.com  2007-11-14 01:30 -------
it seems this bug may be related to similar issues for the event mpm?
PR 43359:
http://issues.apache.org/bugzilla/show_bug.cgi?id=43359

Has a more complicated patch...

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org