Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onBeforeShutdown issue and Process SIGTERM #349

Open
EdmondDantes opened this issue Dec 31, 2023 · 0 comments
Open

onBeforeShutdown issue and Process SIGTERM #349

EdmondDantes opened this issue Dec 31, 2023 · 0 comments

Comments

@EdmondDantes
Copy link

EdmondDantes commented Dec 31, 2023

At the moment, OpenSwoole lacks a proper mechanism for terminating workers in the case of a SIGTERM signal. Additionally:

It is not possible to register SIGTERM using Process::signal because an error will occur, indicating that such an event is already registered by someone else (by whom?).

There is no event that would allow stopping processes when the signal has already been received.

Regarding the operation of the Process::signal() method, its workflow is illogical. It is not possible to set a custom handler if someone (within Swoole) has already done so. From the perspective of proper termination, the server should have the ability to terminate the execution of all workers.

PHP Warning: OpenSwoole\Process::signal(): signal [15] processor has been registered by the system in /HttpServer.php on line 368

25361 | | * | 11:11:36 || Server started and ready [OK]
25364 | 1 | T | 11:11:36 || Worker started [OK]
25365 | 0 | R | 11:11:36 || Worker started [OK]

[2023-12-31 13:11:39 #25361.1] INFO Server is shutdown now
[2023-12-31 13:11:42 *25365.0] WARNING Worker_reactor_try_to_exit() (ERRNO 9012): worker exit timeout, forced termination
25365 | 0 | R | 11:11:43 || Worker stop [OK]
25361 | | * | 11:11:43 || Server shutdown [OK]

Otherwise, we get a forced termination, which seems odd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant