Cleanup children in prefork mode, annotate NORETURN to fix implicit fallthrough#60
Open
flu0r1ne wants to merge 4 commits intognosek:masterfrom
Open
Cleanup children in prefork mode, annotate NORETURN to fix implicit fallthrough#60flu0r1ne wants to merge 4 commits intognosek:masterfrom
NORETURN to fix implicit fallthrough#60flu0r1ne wants to merge 4 commits intognosek:masterfrom
Conversation
With warnings and pedantic mode enabled, `gcc (GCC) 13.2.1` returns an implicit fall through warning. This can be fixed by annotating the error function with NORETURN.
Remove close as it always results in a duplicated call, simplify logic
When attached to a terminal, a SIGINT signal is sent to the parent and all children, instructing them to exit. In some environments including docker, only the parent receives the SIGTERM and is responsible for propagating it to the children. This patch kills all child processes when the parent receives a SIGTERM or a SIGINT.
Author
|
Oh, and it resolves #28 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR primarily addresses issue #19, although it tackles other issues as well. When the
preforkoption is specified via the command line, the initial process spawns a set number of child processes within a control loop. While there is a provision to reap these child processes upon their exit, the master process currently lacks a mechanism to notify them to terminate when it receives aSIGTERMorSIGINT. This behavior can be problematic due to variations in how different init systems and third-party managers handle program management. For example,systemdin its default configuration sendsSIGTERMsignals to all processes in the control group. However, this is not universally true; Docker, for instance, sends aSIGTERMonly to the process specified in theENTRYPOINTinstruction.Key Fixes and Improvements:
NORETURNannotation as a cleaner solution. This change was necessary for successful compilation.SIGTERMsignals to all processes in the process group upon its exit, thereby ensuring graceful termination.I'm up and running with these patches but have not tested this extensively. If maintainers consider merging this, I will follow up. I welcome community feedback.