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

2820 fix hanging child process #2824

Merged
merged 13 commits into from
Jan 13, 2023
Merged

Commits on Jan 13, 2023

  1. Agent: Shutdown the SyncManager explicitly

    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.
    mssalvatore authored and cakekoa committed Jan 13, 2023
    Configuration menu
    Copy the full SHA
    fd5c6dc View commit details
    Browse the repository at this point in the history
  2. Agent: Log singleton assertion errors

    mssalvatore authored and cakekoa committed Jan 13, 2023
    Configuration menu
    Copy the full SHA
    d7ee338 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    88d353d View commit details
    Browse the repository at this point in the history
  4. Agent: Spawn the manager process before acquiring the SystemSingleton

    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.
    mssalvatore authored and cakekoa committed Jan 13, 2023
    Configuration menu
    Copy the full SHA
    b0d0d1b View commit details
    Browse the repository at this point in the history
  5. Agent: Stop the server process if the reactor is not running

    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
    mssalvatore authored and cakekoa committed Jan 13, 2023
    Configuration menu
    Copy the full SHA
    d6e1ac2 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3cf68bd View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f33384c View commit details
    Browse the repository at this point in the history
  8. Changelog: Add an entry for #2820

    mssalvatore authored and cakekoa committed Jan 13, 2023
    Configuration menu
    Copy the full SHA
    38c5bcf View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    13202ef View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    1329758 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    efacb05 View commit details
    Browse the repository at this point in the history
  12. Agent: Forcefully kill the LDAP server process if necessary

    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
    mssalvatore authored and cakekoa committed Jan 13, 2023
    Configuration menu
    Copy the full SHA
    4bacb7b View commit details
    Browse the repository at this point in the history
  13. Agent: Use spawn context for LDAP server process

    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 committed Jan 13, 2023
    Configuration menu
    Copy the full SHA
    409a77f View commit details
    Browse the repository at this point in the history