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

Unit tests run out of file descriptors on MacOS #252

Closed bmerry closed 1 year ago

bmerry commented 1 year ago

MacOS defaults to ulimit -n 256. Pytest seems to be keeping references to fixtures (or at least to data created on test classes by setup_method). But I also need to check whether there are actual filehandle leaks (after objects are destroyed).

A design flaw in spead2 is that there is no way to recover certain resources (particularly semaphores) from an object other than deleting it and praying to the garbage collector. For example, InprocQueue.stop doesn't free the semaphore, and I don't think there is any way it safely could (maybe putting the semaphore behind a shared_ptr, but that will add overheads of its own, and probably require API changes so that users of the queue can each get their own persistent ref).