-
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
improvements to avoids crashes #13615
base: development
Are you sure you want to change the base?
improvements to avoids crashes #13615
Conversation
46c52e1
to
5fde662
Compare
5fde662
to
3b9251c
Compare
@@ -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) |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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
Tracked by: RSDSO-19908