Ticket #140 (new defect)

Opened 5 years ago

Last modified 4 years ago

Windows backend hangs on XP using multiple threads.

Reported by: mozmck Owned by:
Milestone: Component: libusb-1.0 Windows backend
Keywords: Cc:
Blocked By: Blocks:

Description

I have a program with 2 threads. One thread submits OUT transfers, and another thread calls libusb_handle_events_completed(). This event thread also submits an IN transfer which is re-submitted in it's callback.

This code works in Linux, but hangs the program in windows after a short amount of time. I have only tried this in WinXP because that's all I have.

Here is a brief section of the debug output:

libusb: 1.351944 debug [] handling I/O completion with errcode 0
libusb: 1.361958 debug [] matched endpoint 01 with interface 0
libusb: 1.361958 debug [] could not duplicate handle for CancelIo? - using original one
libusb: 1.361958 debug [] writing 60 bytes
libusb: 1.361958 debug [] add fd 6 events 4
libusb: 1.361958 warning [] Unable to cancel I/O that was started from another thread
libusb: 1.361958 debug [] transfer 009D2928 has callback 00464F9F
libusb: 1.361958 debug [] no URB with timeout or all handled by OS; no timeout!
libusb: 1.361958 debug [] doing our own event handling
libusb: 1.361958 debug [] poll() 3 fds with timeout in 60000ms
libusb: 1.361958 warning [] invalid fd
libusb: 1.361958 debug [] poll() returned -1
libusb: 1.361958 error [] poll failed -1 err=9

And here is a section up to the very end of the log when it hung:

libusb: 1.392001 debug [] checking fd 3 with revents = 0000
libusb: 1.392001 debug [] checking fd 4 with revents = 0001
libusb: 1.392001 error [] could not find a matching transfer for fd 4
libusb: 1.392001 error [] backend handle_events failed with error -5
libusb: 1.392001 debug [] no URB with timeout or all handled by OS; no timeout!
libusb: 1.402016 debug [] matched endpoint 01 with interface 0
libusb: 1.402016 debug [] could not duplicate handle for CancelIo? - using original one
libusb: 1.402016 debug [] writing 60 bytes
libusb: 1.402016 debug [] add fd 7 events 4
libusb: 1.402016 debug [] doing our own event handling
libusb: 1.402016 debug [] poll() 5 fds with timeout in 60000ms
libusb: 1.402016 debug [] poll() returned 3
libusb: 1.402016 debug [] checking fd 3 with revents = 0000
libusb: 1.402016 debug [] checking fd 4 with revents = 0001

Attachments

libusb_dump.txt (73.4 KB) - added by mozmck 5 years ago.
libusb debug output

Download all attachments as: .zip

Change History

Changed 5 years ago by mozmck

libusb debug output

comment:1 Changed 5 years ago by xiaofan

You may want to try out the git version instead of 1.0.9. Or you can try out libusbx 1.0.12
(www.libusbx.org, which is a fork of libusb-1.0). libusb-1.0.9 release has serious bugs with regard to Windows backend.

git logs for libusb-1.0: http://git.libusb.org/?p=libusb.git

comment:2 Changed 5 years ago by mozmck

I have used the git version and I tried libusbx and the problem exists everywhere.

Note: See TracTickets for help on using tickets.