Skip to content
Discussion options

You must be logged in to vote

And I found when I successfully shutdown server by ctrl-c, the except (KeyboardInterrupt, SystemExit, anyio.get_cancelled_exc_class()) as e: block is never entered. It directly goes to the finally block.

Granian doesn't propagate signals to the application.
If you want to manage the signals yourself you need to use the embedded server.

Also there's an another problem is that if I start some background tasks inside startup_hook using anyio taskgroup, it always prevent server shutdown after finishing finally block and results to force kill behaviour.

Granian shutdown connections gracefully. If you start any other task, you need to handle client disconnections (there's a specifc ASGI eve…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@hermeschen1116
Comment options

Answer selected by hermeschen1116
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #761 on December 05, 2025 11:50.