summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorStefan Fritsch <sf@debian.org>2007-12-04 22:12:23 +0000
committerStefan Fritsch <sf@sfritsch.de>2012-01-02 10:36:48 +0100
commite5d1b07035bfde46392ef02f2b3e98b4b6ae01cc (patch)
tree342845d67e90b7407e31cea81c9f48aaa8e6fe79 /debian
parent592c261fa0a87f6d2eb9520dc2ad2fe478dfd141 (diff)
downloadapache2-e5d1b07035bfde46392ef02f2b3e98b4b6ae01cc.tar.gz
Update 053_bad_file_descriptor_PR42829.dpatch
git-svn-id: svn+ssh://svn.debian.org/svn/pkg-apache/trunk/apache2@493 01b336ce-410b-0410-9a02-a0e7f243c266
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog3
-rwxr-xr-xdebian/patches/053_bad_file_descriptor_PR42829.dpatch66
2 files changed, 65 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog
index b6fe7d19..8b067ad7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,8 +3,9 @@ apache2 (2.2.6-3) UNRELEASED; urgency=low
* Add Homepage field to debian/control.
* Allocate fewer bucket brigades in case of a flush bucket. This might help
with the memory leaks reportet in #399776 and #421557.
+ * Update 053_bad_file_descriptor_PR42829.dpatch to avoid a race condition.
- -- Stefan Fritsch <sf@debian.org> Tue, 04 Dec 2007 22:59:20 +0100
+ -- Stefan Fritsch <sf@debian.org> Tue, 04 Dec 2007 23:10:14 +0100
apache2 (2.2.6-2) unstable; urgency=low
diff --git a/debian/patches/053_bad_file_descriptor_PR42829.dpatch b/debian/patches/053_bad_file_descriptor_PR42829.dpatch
index b7c46262..5784ad3e 100755
--- a/debian/patches/053_bad_file_descriptor_PR42829.dpatch
+++ b/debian/patches/053_bad_file_descriptor_PR42829.dpatch
@@ -7,8 +7,39 @@
@DPATCH@
--- a/server/mpm/prefork/prefork.c-dist 2007-07-17 16:48:25.000000000 +0200
-+++ b/server/mpm/prefork/prefork.c 2007-10-18 14:23:49.698231000 +0200
-@@ -570,6 +570,11 @@
++++ b/server/mpm/prefork/prefork.c 2007-11-16 10:42:08.588895000 +0100
+@@ -137,10 +137,12 @@
+ int tpf_child = 0;
+ char tpf_server_name[INETD_SERVNAME_LENGTH+1];
+ #endif /* TPF */
+
+ static volatile int die_now = 0;
++static volatile int listeners_closed = 0;
++static int active_connection = 0;
+
+ #ifdef GPROF
+ /*
+ * change directory for gprof to plop the gmon.out file
+ * configure in httpd.conf:
+@@ -328,11 +330,14 @@
+ clean_child_exit(0);
+ }
+
+ static void stop_listening(int sig)
+ {
+- ap_close_listeners();
++ if (active_connection) {
++ ap_close_listeners();
++ listeners_closed = 1;
++ }
+
+ /* For a graceful stop, we want the child to exit when done */
+ die_now = 1;
+ }
+
+@@ -568,10 +573,15 @@
+ /* multiple listening sockets - need to poll */
+ for (;;) {
apr_int32_t numdesc;
const apr_pollfd_t *pdesc;
@@ -20,7 +51,11 @@
/* timeout == -1 == wait forever */
status = apr_pollset_poll(pollset, -1, &numdesc, &pdesc);
if (status != APR_SUCCESS) {
-@@ -618,8 +623,14 @@
+ if (APR_STATUS_IS_EINTR(status)) {
+ if (one_process && shutdown_pending) {
+@@ -616,12 +626,18 @@
+ }
+ got_fd:
/* if we accept() something we don't want to die, so we have to
* defer the exit
*/
@@ -36,3 +71,28 @@
SAFE_ACCEPT(accept_mutex_off()); /* unlock after "accept" */
if (status == APR_EGENERAL) {
+ /* resource shortage or should-not-occur occured */
+ clean_child_exit(1);
+@@ -633,15 +649,22 @@
+ /*
+ * We now have a connection, so set it up with the appropriate
+ * socket options, file descriptors, and read/write buffers.
+ */
+
++ active_connection = 1;
++ if (die_now && !listeners_closed) {
++ ap_close_listeners();
++ listeners_closed = 1;
++ }
++
+ current_conn = ap_run_create_connection(ptrans, ap_server_conf, csd, my_child_num, sbh, bucket_alloc);
+ if (current_conn) {
+ ap_process_connection(current_conn, csd);
+ ap_lingering_close(current_conn);
+ }
++ active_connection = 0;
+
+ /* Check the pod and the generation number after processing a
+ * connection so that we'll go away if a graceful restart occurred
+ * while we were processing the connection or we are the lucky
+ * idle server process that gets to die.