]> git.pld-linux.org Git - packages/apache.git/blob - apache-prefork-graceful-fix.patch
- from upstream: fix child process hang during graceful restart/stop in
[packages/apache.git] / apache-prefork-graceful-fix.patch
1 --- server/mpm/prefork/prefork.c        2009/01/31 20:53:11     739607
2 +++ server/mpm/prefork/prefork.c        2009/01/31 20:54:55     739608
3 @@ -577,19 +577,27 @@
4                  apr_int32_t numdesc;
5                  const apr_pollfd_t *pdesc;
6  
7 -                /* timeout == -1 == wait forever */
8 -                status = apr_pollset_poll(pollset, -1, &numdesc, &pdesc);
9 +                /* check for termination first so we don't sleep for a while in
10 +                 * poll if already signalled
11 +                 */
12 +                if (one_process && shutdown_pending) {
13 +                    SAFE_ACCEPT(accept_mutex_off());
14 +                    return;
15 +                }
16 +                else if (die_now) {
17 +                    /* In graceful stop/restart; drop the mutex
18 +                     * and terminate the child. */
19 +                    SAFE_ACCEPT(accept_mutex_off());
20 +                    clean_child_exit(0);
21 +                }
22 +                /* timeout == 10 seconds to avoid a hang at graceful restart/stop
23 +                 * caused by the closing of sockets by the signal handler
24 +                 */
25 +                status = apr_pollset_poll(pollset, apr_time_from_sec(10), 
26 +                                          &numdesc, &pdesc);
27                  if (status != APR_SUCCESS) {
28 -                    if (APR_STATUS_IS_EINTR(status)) {
29 -                        if (one_process && shutdown_pending) {
30 -                            return;
31 -                        }
32 -                        else if (die_now) {
33 -                            /* In graceful stop/restart; drop the mutex
34 -                             * and terminate the child. */
35 -                            SAFE_ACCEPT(accept_mutex_off());
36 -                            clean_child_exit(0);
37 -                        }
38 +                    if (APR_STATUS_IS_TIMEUP(status) ||
39 +                        APR_STATUS_IS_EINTR(status)) {
40                          continue;
41                      }
42                      /* Single Unix documents select as returning errnos
This page took 0.033291 seconds and 4 git commands to generate.