hypercorn icon indicating copy to clipboard operation
hypercorn copied to clipboard

graceful_timeout not respected on Python 3.12

Open vexofp opened this issue 6 months ago • 1 comments

On Python 3.12+, after the shutdown_trigger is set, Hypercorn will wait indefinitely for ongoing requests to finish. This is contrary to the documented behavior, which says it should only wait up to config.graceful_timeout seconds, as well as to the behavior on older versions of Python.

vexofp avatar Jun 23 '25 00:06 vexofp

This is a result of the call(s) to server.wait_closed() in the shutdown path. Starting in 3.12, this method now waits until "all active connections have finished". (Change implemented in https://github.com/python/cpython/issues/79033 with additional discussion in https://github.com/python/cpython/issues/104344.)

The recommend fix seems to be just not calling wait_closed().

vexofp avatar Jun 23 '25 00:06 vexofp