Skip to content

improvements to avoids crashes - #13615

Merged
remibettan merged 5 commits into
realsenseai:developmentfrom
remibettan:ensovision_issues
Jan 6, 2025
Merged

improvements to avoids crashes#13615
remibettan merged 5 commits into
realsenseai:developmentfrom
remibettan:ensovision_issues

Conversation

@remibettan

Copy link
Copy Markdown
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 5 times, most recently from 5fde662 to 3b9251c Compare December 18, 2024 12:20
Comment thread src/win/win-helpers.cpp Outdated

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

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread src/win/win-helpers.cpp Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread src/win/win-helpers.cpp Outdated

// Enumerate all imaging devices
for (int member_index = 0; ; ++member_index)
// high limit is below loop has been added to avoid infinite loop

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

0x10000 is a large enough limit to avoid...

@Nir-Az Nir-Az left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@remibettan
remibettan merged commit 2a4e78a into realsenseai:development Jan 6, 2025
@remibettan
remibettan deleted the ensovision_issues branch July 29, 2025 14:08
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