-
Notifications
You must be signed in to change notification settings - Fork 788
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
2820 fix hanging child process #2824
Merged
Merged
Conversation
This file contains 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
Codecov ReportBase: 64.45% // Head: 64.78% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #2824 +/- ##
===========================================
+ Coverage 64.45% 64.78% +0.32%
===========================================
Files 413 413
Lines 11737 11752 +15
===========================================
+ Hits 7565 7613 +48
+ Misses 4172 4139 -33
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
mssalvatore
force-pushed
the
2820-fix-hanging-child-process
branch
from
January 12, 2023 01:25
66ced46
to
0b20018
Compare
mssalvatore
force-pushed
the
2820-fix-hanging-child-process
branch
from
January 12, 2023 12:55
0b20018
to
48a7d39
Compare
Sometimes, the manager and agent processes are hanging instead of shutting down. This commit explicitly calls shutdown() on the manager object to ensure it terminates.
The SystemSingleton uses an abstract unix socket as a "lock" to ensure only one agent at a time runs on a given machine. It seems that if a manager process is spawned after this unix socket is created, the manager process inherits this file handle, which leads to the socket never being properly closed. Spawning the manager before the socket is opened is a quick solution to this problem. A better solution (see #2817) is to use a different method than a unix socket to achieve this goal, but, baby steps for now.
Just because the Twisted reactor failed to start doesn't mean that the server process is not running. The server process should be stopped before raising the LDAPServerStartError, otherwise the server or process may be left running indefinitely. Fixes #2820
Using Twisted for the Log4Shell exploiter has been nothing but trouble since the beginning. When we refactor this exploiter we should use another solution. In the meanwhile, we must be doing something wrong WRT stopping Twisted. The heavy-handed approach is to SIGKILL the process. This isn't ideal, but will be changed when we refactor this component. Issue #2820
cakekoa
force-pushed
the
2820-fix-hanging-child-process
branch
from
January 13, 2023 13:35
d3e4dab
to
4bacb7b
Compare
mssalvatore
commented
Jan 13, 2023
Forked processes will inherit all resources from the parent process. This includes the socket we use for ensuring only a single agent is running at any given time. Additionaly, threads will also be inherited by the forked process, which could cause problems. Using a spawn context should fix our singleton issue, and give the process a cleaner environment in which to run. Issue #2820
cakekoa
force-pushed
the
2820-fix-hanging-child-process
branch
from
January 13, 2023 18:01
eb3b77a
to
409a77f
Compare
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.
What does this PR do?
Fixes #2820
PR Checklist
Was the documentation framework updated to reflect the changes?Testing Checklist
Added relevant unit tests?If applicable, add screenshots or log transcripts of the feature working