This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Description
While using cirque I ran into some warnings concerning process management:
/usr/lib/python3.8/subprocess.py:942: ResourceWarning: subprocess 28203 is still running
_warn("subprocess %s is still running" % self.pid,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/lib/python3.8/subprocess.py:942: ResourceWarning: subprocess 28202 is still running
_warn("subprocess %s is still running" % self.pid,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
cirque/connectivity/socatpipepair.py:48: ResourceWarning: unclosed file <_io.BufferedReader name=3>
self.socat = None
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Following changes would fix it. Feel free to use them as you feel fit:
diff --git a/cirque/connectivity/socatpipepair.py b/cirque/connectivity/socatpipepair.py
index 2b64149..c3c2c38 100644
--- a/cirque/connectivity/socatpipepair.py
+++ b/cirque/connectivity/socatpipepair.py
@@ -45,6 +45,8 @@ class SocatPipePair:
def close(self):
if self.socat is not None:
self.socat.terminate()
+ self.socat.wait()
+ self.socat.stderr.close()
self.socat = None
def __del__(self):
diff --git a/cirque/connectivity/threadsimpipe.py b/cirque/connectivity/threadsimpipe.py
index 02de636..6ad360f 100644
--- a/cirque/connectivity/threadsimpipe.py
+++ b/cirque/connectivity/threadsimpipe.py
@@ -64,6 +64,7 @@ class ThreadSimPipe:
self.radio_fd = None
if self.radio_process is not None:
self.radio_process.terminate()
+ self.radio_process.wait()
self.radio_process = None
if self._socat_pipe is not None:
self._socat_pipe.close()
Thanks and regards