ska-sa / spead2

Library for the Streaming Protocol for Exchange of Astronomical Data (SPEAD)
http://spead2.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
23 stars 14 forks source link

Python send stream can deadlock on shutdown #251

Open bmerry opened 1 year ago

bmerry commented 1 year ago

I'm unable to reproduce this now, but a one point running examples/test_send.py would hang rather than exiting. My theory is that it's because the stream destructor waits for the writer thread to make forward progress, but if the thread pool gets stopped first by the atexit handler, then it can't make progress.

The fix will probably be to give stream an exit_stopper that flushes and waits in the same way as stream::~stream.