Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Better error handling during force shutdown #2271
Refactors tests covering shutdown behavior to be less flaky (the current tests depend on fragile
Your checklist for this pull request
I think my only concerns are the concurrency-awareness being added to Server when I think it hasn't had many concurrency-related reponsibilities yet. I'm wondering if we can shove all of that into Reactor instead so we keep Puma's main "concurrency-aware" classes as Reactor and Threadpool.
If that Reactor refactoring seems reasonable, this PR might be simpler following that one (e.g., 9975355.)
Only allow `ForceShutdown` to be raised in a thread during specific areas of the connection-processing cycle (marked by `with_force_shutdown` blocks), to ensure that the raised error is always rescued and handled cleanly. Fixes an issue where the `force_shutdown_after: 0` option throws uncaught exceptions from the threadpool on shutdown.