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 }}
Repository navigation
libusb: avoid hanging when read-thread creation fails #842
hid_open_path() can hang indefinitely when the libusb backend cannot create its read thread. Coverity CID 1706123 (CHECKED_RETURN) identifies the discarded pthread_create() result in libusb/hidapi_thread_pthread.h:153.
At master 16a3ce903683efa27e25c1820e37159d120f7563, hidapi_thread_create() returns void. hidapi_initialize_device() calls it and then unconditionally waits at the two-party startup barrier. If creation returns EAGAIN, no read thread exists to reach the barrier.
Confirmed with fault injection into the current pthread wrapper: forcing pthread_create() to return EAGAIN leaves hidapi_thread_barrier_wait() blocked until a 2-second watchdog terminates the reproducer. This failure does not require concurrent API misuse or hardware-specific behavior.
Expected fix: propagate thread-creation failure, skip the startup barrier and join, unwind the claimed interface/input buffer through the existing cleanup path, and return an open failure. Add a deterministic no-hardware regression covering the error path and successful startup.
The hotplug work in #825 already contains related thread-creation handling. This issue tracks extracting the minimal fix independently onto master; custom HIDAPI_THREAD_MODEL_INCLUDE compatibility must be documented consistently with #829.
Related to #825, #829 and #841. The compatibility notice #829 should remain open.
Activity