-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
libusb crash for multiple idling cameras #12400
Comments
To clarify: We dont get the error, once the rs2::context gets used, e.g. calling query_devices() |
Hi @fk-bbraun There was a past case of this type of __GI___pthread_mutex_lock error at #10112 where the program would fail after 1 hour. In that case, I suggested monitoring the Ubuntu system resources for evidence of a memory leak that could cause an application to crash after a period of time had passed. |
Memory consumption does not increase once started. Plenty left. |
A solution may be to call rs2::context first to avoid the error (as you suggest above) and build the list of attached camera devices with query_devices(), But then you can choose how long to wait before actually doing something with those cameras with a pipe.start() instruction to enable the camera streams (for example, putting a sleep period before the pipe.start() line). So you do not need to activate the cameras immediately once query_devices has constructed the list of cameras. |
I tried the proposed workaround. I queried the devices before idling. Still with the two uninitialized cameras the realsense->libusb will crash the application after 2-10min. |
Which method did you use to install the librealsense SDK, please? If the SDK is built from source code with CMake with the flag -DFORCE_RSUSB_BACKEND=TRUE then performance with multiple cameras will not be as good as a package installation or a source code build where RSUSB = false. This is because an RSUSB build of the SDK is best suited to single-camera applications. |
Thanks, I think we are going in the right direction. We are using the RSUSB backend. So yes, I might experiment with using the kernel patches instead. Seems a long way though, since this was the first time we experienced a problem with RSUSB in a multicam setup. It would be interesting, if the realsense team could resolve this in librealsense itself, e.g. by insuring no concurrent access (at least from within the same process) For now, I seem to have workarounded the issue by delaying the rs2::context creation till we really need it. The initialization of our cameras is not in parallel, so there should be no more concurrent access. |
Thanks very much for the update. Please do let me know if you experience any further problems. Good luck! |
Hi @fk-bbraun Do you require further assistance with this case, please? Thanks! |
No, thank you, the workaround from above works. I still think the underlying problem in librealsense should be attended to one way or the other. |
Hello,
we have a problem in a system that uses two realsense cameras. There is a rather uncommon usage mode, where we dont interact with the cameras directly or ever, still we will construct some basic rs2 objects in our constructor to be used later. After 10-15min we usually get a crash with a stacktrace pointing to libusb:
or
While the obvious fix seems to be not constructing the objects when not using them, I still wanted to report this flaw. Realsense's usage of libusb calls does not seem to be thread-safe. A minimal snippet to reproduce this error usually within 10s is:
PS: This might be somewhat similar to the abandoned problem in #12280.
The text was updated successfully, but these errors were encountered: