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

improvements to avoids crashes #13615

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

remibettan
Copy link
Contributor

Tracked by: RSDSO-19908

@remibettan remibettan requested a review from Nir-Az December 18, 2024 12:07
@remibettan remibettan force-pushed the ensovision_issues branch 4 times, most recently from 46c52e1 to 5fde662 Compare December 18, 2024 12:19
@@ -491,14 +491,15 @@ namespace librealsense
}

// Enumerate all imaging devices
for (int member_index = 0; ; ++member_index)
for (DWORD member_index = 0; member_index < 0x10000; ++member_index)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain? add comment? why < 0x10000?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is only some limit to avoid infinite loop. No real meaning for this number - only assuming that there will be no system with 0x10000 (65,536) devices.
I ll add a comment.

break; // stop when none left
continue; // silently ignore other errors
DWORD last_error = GetLastError();
if ((last_error == ERROR_NO_MORE_ITEMS) || (last_error == ERROR_INVALID_HANDLE))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you also explain why this was added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The customer was complaining that the error ERROR_INVALID_HANDLE happened sometimes, and that this was leading to infinite loop (see in ticket).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if this can happen when looping the devices even if not finished yet or only after.
If we will get it in the middle we will nor enumerate the device right?
On Linux it will be forever as the trigger is udev.
We need to make sure we need to break on the first time we see this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants