[issue33603] Subprocess Thread handles grow with each call and aren't released [Windows]

GranPrego report at bugs.python.org
Wed May 23 07:18:29 EDT 2018


GranPrego <josephdeller at googlemail.com> added the comment:

I'm now pretty convinced that sounddevice 0.3.11 library is the culprit, which may in turn point to the portaudio library, or CFFI.

I make a call to sd.play() just before calling subprocess to run the dos cmd, the timing was such that process explorer would make it look like the leak was occurring during the subprocess call, but isolating the sd.play  shows that it causing the two additional Thread handles to be created and never released until the script ends (which could be 1-48 hours or more)

Another section of the code was using sd._terminate() and sd._initialize() to work around a buffersize problem with sounddevice and these calls also leak thread handles.

I've cut the program down as much as possible and the following now shows the problem without the call to subprocess.  You'll need to change the sd.default.device to an appropriate sound card.

Thanks for the quick responses.  If you're happy that this is the correct analysis of issue then perhaps it could be reclassified as a different component or I can get in touch with the sounddevice author.

Regards,
Joe

----------
Added file: https://bugs.python.org/file47613/soundeviceLeaker.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33603>
_______________________________________


More information about the Python-bugs-list mailing list