Closed ssssam closed 5 years ago
Wow! This is a great, simple fix to a subtle problem. Thank you for doing the investigation to figure this out! :sparkles: :rocket:
No problem. Thanks for all your work on Beets :-)
This PR fixed my testcase, but it hasn't actually fixed the issue when doing a beet import
:-(
This fixes intermittent crashes that were introduced by commit ac7b1e07ea47a1ebfc.
In some situations the .close() method is called before the child process has completed. If we close proc.stderr and proc.stdout while a QueueReaderThread instance is still running, we get errors such as this:
Sometimes the CPython interpreter segfaults inside the io.read() call before it can show this error.
We now kill the child process and wait for it to terminate before closing the stdout and stderr pipes. This gives the queue reader threads time to receive the end-of-file notifications from the pipes while they are still open.