Hi,

As preparation for the 1.0.16-rc1 release I've been going over all the
open issues, while looking at:
https://github.com/libusbx/libusbx/issues/25

I ended up looking at:
https://github.com/libusbx/libusbx/commit/2f5023c41d3176e56bf0abc521b7c5f8b1ac4664

And I noticed that this patch seems wrong, if the cancel fails it does not
wait but it still frees the transfer, which at that point is still referenced
by the underlying urb, which has potentially not completed yet.

I also believe the original reason for applying this patch is not valid, looking
at the original report:
http://libusbx.1081486.n5.nabble.com/Libusbx-devel-libusb-interrupt-transfer-does-not-return-in-case-of-error-td626.html

It talks about the following error messages, after which the program hangs in
libusb_interrupt_transfer()  :

[372849.680990] [0000275b] libusbx: error [reap_for_handle] reap failed error 
-1 errno=14
[372849.681752] [0000275b] libusbx: error [handle_events] backend handle_events 
failed with error -1
[372850.680466] [0000275b] libusbx: warning [handle_timeout] async cancel 
failed -5 errno=22

Notice the "error [reap_for_handle] reap failed error -1 errno=14",
errno 14 is EFAULT, iow the problem is not "Sometimes there is a communication 
error with the device"
but that the app in question is buggy, and is either passing in a too small 
buffer, or just plain
invalid memory as the buffer for libusb_interrupt_transfer().

I see 2 options to move forward with this:
1) Keep the patch, but if the cancel fails do not free the transfer, this is not
really helpful, since the app could still kill the buffer the transfer 
references
after we return.

2) Revert the patch, and re-open https://github.com/libusbx/libusbx/issues/76
Asking the user for source for the app in question, and hunt down the real bug
there.

May vote goes to 2, input much appreciated (iow please give me your 2 cents) ?

Regards,

Hans

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to