You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 21, 2025. It is now read-only.
UniversalQueue has a race condition in the _put_notify() and _put() methods. Since a future object is cancelled without holding the lock, a future.cancel() call[1][2][3][4] can occur after future.cancelled() but before future.set_result(). As a result, concurrent.futures.InvalidStateError will be raised.
Since this is a multi-threaded issue, it cannot be reliably reproduced. Instead, below is synthetic code that demonstrates that behavior.
The quickest solution is to suppress concurrent.futures.InvalidStateError, but this requires returning the item back to the queue in the _put() method. A more correct solution is to use future.set_running_or_notify_cancel().
Note that UniversalEvent has the same problem in the _unblock_waiters() method[1][2][3].