Skip to content
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

Dispatcher deadlock workaround #10517

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ namespace librealsense

void add_software_device(std::shared_ptr<device_info> software_device);

void stop_device_watcher()
{
if (!_device_watcher->is_stopped())
_device_watcher->stop();
}

#if WITH_TRACKING
void unload_tracking_module();
#endif
Expand Down
1 change: 1 addition & 0 deletions src/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ device::device(std::shared_ptr<context> ctx,

device::~device()
{
_context->stop_device_watcher();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it'd work, sure -- but why stop the context picking up new devices?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@v-lopez Can you suggest a better solution to this issue?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't looked into the issue further. But I've been using this since then and I haven't appreciated any side effects.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@v-lopez
First, thanks for the PR, we appreciate it.
However, after reading the origin thread I am a little confused, as it seems to mix ROS (initial_reset) and plain libRS where the fix was made.
Can you provide a way for this deadlock to be reproduced with librealsense, either in C++ or Python? Once I understand how to reproduce I can add it to our unit-tests and see if I can solve it. Otherwise we'll likely direct it to our ROS guy to try and reproduce and see if the problem is there.

if (_device_changed_notifications)
{
_context->unregister_internal_device_callback(_callback_id);
Expand Down