You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Agent uses multiprocessing to run plugins. It's possible that a plugin could hang indefinitely, preventing the parent (Agent) process from ever fully shutting down. Add some logic to main.py to attempt to forcefully kill any child processes still running. Watch out for the resource tracker.
Pseudocode
Be sure to add debug logging to the example below.
diff--gita/monkey/infection_monkey/main.pyb/monkey/infection_monkey/main.pyindex9cf58b505..b12b84e44100644---a/monkey/infection_monkey/main.py+++b/monkey/infection_monkey/main.py
@@ -179,6+179,20 @@ def_run_agent(
logger.exception(
"Exception thrown from monkey's cleanup function: More info: {}".format(err)
)
+finally:
+importpsutil++forpinpsutil.Process().children(recursive=True):
+if"multiprocessing.resource_tracker"inp.cmdline()[2]:
+# This process will clean itself up, but no other processes should be running at+# this time.+continue++p.kill()
if"__main__"==__name__:
Tasks
modify main.py to kill hung child processes (0.25d) @mssalvatore
Plugins that hang can prevent the agent from closing. On agent shutdown,
we'll forcefully kill all child processes that have not shutdown on
their own.
Issue #3557
Plugins that hang can prevent the agent from closing. On agent shutdown,
we'll forcefully kill all child processes that have not shutdown on
their own.
Issue #3557
Description
The Agent uses multiprocessing to run plugins. It's possible that a plugin could hang indefinitely, preventing the parent (Agent) process from ever fully shutting down. Add some logic to main.py to attempt to forcefully kill any child processes still running. Watch out for the resource tracker.
Pseudocode
Be sure to add debug logging to the example below.
Tasks
Test Plugin
Mock1-exploiter.tar.gz
The text was updated successfully, but these errors were encountered: