-
-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usb3: multithreading causes mixup in libusb responses #622
Comments
Hi Edgar, Thanks for the report. Does it also happen when async usb mode is enabled ? Could you open a merge request with your fix in |
Hi Emmanuel, I just verified it again. The bug happens with sync and async. Merge request has been opened. |
My understanding is the message mixup should not happen if a device is only accessed by the same thread. Aravis is not thread safe, and once a camera is instantiated, it should only be manipulated by a single thread, as well as its underlying objects (device, stream). Anyway, as it can not hurt, I have applied your merge request to main. |
You are correct, this only happens in multi threaded applications. But as it is, things happen and better safe than sorry. Thanks for the merge! Take care. |
Hi @TIS-Edgar I'm reopening this issue as may be a global mutex is overkill. Could you check merge request #625, which uses an instance mutex ? |
Just tested your commit. Everything seems to work correctly. |
Ok. Thanks Edgar. |
Describe the bug
When using a USB3 camera in a complex multi-threaded application a reliable timeout of libusb ack packages can be achieved.
This causes the camera to ignore commands or the application to behave in unexpected ways.
In my case it reliably prevents a stream start.
Excerpt of log output with
ARV_DEBUG=all:3
and arvuvdevice.c modified for more debugging information:To Reproduce
In theory every application that simultaneously starts a stream and queries properties should exhibit this behavior.
arv-viewer-0.8 behaves fine.
tcam-capture on our development branch shows this behavior reliably.
Expected behavior
Correct association between cmd and ack.
Camera description:
Tested with multiple TIS USB3 cameras.
Platform description:
Aravis version:
Current master (b8af426)
OS: [e.g. Fedora 20]
Tested on Debian testing
Hardware [e.g. x86_64]
amd64
Additional context
We were able to fix this by locking the loop in arvuvdevice.c _send_cmd_and_receive_ack with an additional mutex.
This prevented any
miscommunication
between cmds/acks and seems to solve the issue.Since I am uncertain if this is a sufficient solution, I thought a bug report might be warranted.
The text was updated successfully, but these errors were encountered: