Skip to content

graceful_timeout not respected on Python 3.12 #308

Open

Description

@vexofp

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.

Activity

  1. vexofp commented on Jun 23, 2025

    @vexofp
    Author

    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 python/cpython#79033 with additional discussion in python/cpython#104344.)

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

  2. msat-cont commented on Dec 27, 2025

    @msat-cont

    Hi, is there a progress on this issue? It is a bit terrible when the shutdown does not work.

  3. ahxxm commented on Mar 14, 2026

    @ahxxm

    wait_closed() also seems to wait for all active connections, listening sockets + websocket(for example), I've reliably reproduce 'unblock' C-c shutdown by close a tab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions