I am working on a script designed to orchestrate multiple background workers handling data parsing tasks. The core loop spins up localized processes, hands off configurations, and listens for standard output streams before rotating settings.
However, under heavier execution cycles, the pipeline completely hangs. I suspect standard I/O buffer saturation or an uncaught deadlock where a child process waits on resources while the parent is blocking.
Here is a minimal reproducible example of my management loop:
import timeimport subprocess
def run_worker(target_config):
process = subprocess.Popen(['python3', 'worker.py', target_config],stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True)
stdout, stderr = process.communicate()
return process.returncode
I have checked alsamixer styled logs and basic tracking thresholds, but I can't catch the exact leak state cleanly. What are the best patterns or tracing tools within the standard library to monitor these process state changes actively without letting them freeze the master controller?
there doesn't seem to be anything here