Closed TurboTurtle closed 2 years ago
So at first glance it seems we're a bit too aggressive with killing off the rig. If we're watching multiple PIDs, I would think we should only terminate if all those pids are no longer running (unless of course the rig is watching for a PID to die, so this may get a little tricky with the logic).
Right... so this is because the watcher thread exits, and our futures pool is waiting for the first job to return.
For the moment, I don't have a good idea of how to address this beyond artificially keeping the watcher thread active. For example, detect that the PID no longer exists and if we have more than one PID to watch spin on wait_loop()
instead of hitting the return False
line. That doesn't seem too terrible, but it is a bit hacky. My biggest concern would be this combined with another request (issue to be opened), where --all-pids
would look for PIDs that started after the rig was deployed. We could potentially get ourselves in a position where we have an absurd number of threads spinning on nothing.
User report from CEE SD testing:
Created the rig with two processes running, simulating some load. One of the processes finished and stopped before load went about the target.
However the rig stopped monitoring as soon as the first process died off.
Rig seems to working and this might be an RFE to the functionality but wanted to submit this just in case it is possible to change this behavior.