Skip to content

Commit

Permalink
Fix incorrect application of startup timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed Aug 3, 2021
1 parent 458f67c commit acb6db3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 11 additions & 0 deletions docs/release-notes/version-4.9.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ Bugs Fixed
timeout period had expired, and not as soon as any active requests had
completed, if that had occurred before the graceful timeout had expired.

* When using the ``startup-timeout`` and ``restart-interval`` options of
``WSGIDaemonProcess`` directive together, checking for the expiration
time of the startup time was done incorrectly, resulting in process
restart being delayed if startup had failed. At worst case this was the
lessor of the time periods specified by the options ``restart-interval``,
``deadlock-timeout``, ``graceful-timeout`` and ``eviction-timeout``. If
``request-timeout`` were defined it would however still be calculated
correctly. As ``request-timeout`` was by default defined when using
``mod_wsgi-express``, this issue only usually affect mod_wsgi when
manually configuring Apache.

Features Changed
----------------

Expand Down
7 changes: 5 additions & 2 deletions src/server/mod_wsgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -9354,7 +9354,8 @@ static void *wsgi_monitor_thread(apr_thread_t *thd, void *data)
}
}
else {
period = restart_time - now;
if (!period || ((restart_time - now) < period))
period = restart_time - now;
}
}
}
Expand Down Expand Up @@ -9463,8 +9464,10 @@ static void *wsgi_monitor_thread(apr_thread_t *thd, void *data)
kill(getpid(), SIGINT);
}

if (restart || wsgi_request_timeout || period <= 0)
if (restart || wsgi_request_timeout || period <= 0 ||
(wsgi_startup_timeout && !wsgi_startup_shutdown_time)) {
period = apr_time_from_sec(1);
}

apr_sleep(period);
}
Expand Down

0 comments on commit acb6db3

Please sign in to comment.