1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
Commit graph

3 commits

Author SHA1 Message Date
Will Jordan
c1a98f8f22
Fix hang on shutdown in test_refork [changelog skip] (#2442)
* Prevent server from starting if worker receives TERM signal
If a worker receives a `TERM` signal before the server has started,
prevent it from starting at all by clearing `restart_server`.

* Send TERM to fork_worker child processes in Cluster#wait_workers
When `fork_worker` is used, the call to `Process.wait` in `wait_workers`
returns `ECHILD` for forked workers.
Add a call to `w.term` in the rescue clause to match the behavior when
`fork_worker` is not used, ensuring workers shut down properly.

* Add test_command_ignored_before_run
Unit test clarifying behavior of commands sent before Server#run is called.
2020-10-22 13:54:15 -06:00
Will Jordan
2f90396c95
Fire on_booted after server starts (#2431)
Fixes #2212
2020-10-16 07:34:22 -06:00
Chris LaRose
de632261ac
Refactor: extract worker process into separate class [changelog skip] (#2374)
* Rename Puma::Cluster::{Worker => WorkerHandle}

This class represents a worker from the perspective of the puma master
process. It provides methods for controlling the process, but doesn't
contain the logic actually executed by the worker.

In preparation for creating a new class that encapsulates the worker
logic, we're renaming this one to WorkerHandle.

* Extract Puma::Cluster::WorkerHandle to a separate file

* Move worker functionality to new class

Before, all functionality of the worker processes was defined in the
Cluster class. In preparation for making it possible to start worker
processes outside of the context of a Cluster instance, we move the
worker functionality into a new class.

This has the additional benefit of delineating exactly the dependencies
of the worker processes, namely the Launcher, options hash, and the
pipes used for inter-process communication.

* Extract nakayoshi_gc to Puma::Util

* Add comment to describe Puma::Cluster::WorkerHandle

* Remove options from Worker constructor

The instance varaible @options can be derived from the @launcher
2020-09-29 07:21:52 -06:00