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

fix abort in some cases with DDS #13627

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

Conversation

AviaAv
Copy link
Contributor

@AviaAv AviaAv commented Dec 24, 2024

Fixed an issue where we randomly see an error where abort() is called after we finish using DDS (in the d'tor), added a try catch block due to the race condition there
Tracked on: [LRS-1212]

@AviaAv AviaAv requested a review from Nir-Az December 24, 2024 12:34
@Nir-Az Nir-Az requested a review from maloel December 24, 2024 13:03
@Nir-Az
Copy link
Collaborator

Nir-Az commented Dec 24, 2024

@maloel can you review?
We saw sporadic crash by this 2 lines:

_th.detach(); // so it's not joinable

the condition for joinable and the actual join actions are not atomic.
Maybe we can drop the join at all?

Currently this issue was also raised by validation as a critical BUG.

@@ -72,8 +72,14 @@ class network_adapter_watcher_singleton
~network_adapter_watcher_singleton()
{
_adapter_watcher.reset(); // signal the thread to finish
if( _th.joinable() )
_th.join();
try {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Formatting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved the opening bracket to a new line

}
catch (std::system_error&)
{
std::cerr << "join failed, thread might no longer be joinable";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use LOG_ERROR

Copy link
Collaborator

Choose a reason for hiding this comment

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

And, if there's an error, there's an error message too, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

@maloel maloel left a comment

Choose a reason for hiding this comment

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

Please see the comments; otherwise good to go

}
catch (std::system_error& e)
{
LOG_ERROR("join failed, thread might no longer be joinable, Error:" << e.what());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure this will work.
Can you try to see if it works and you see the e.what()?
You might need to use rsutils::from() <<

Copy link
Collaborator

Choose a reason for hiding this comment

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

LOG_ERROR has <<, if that was the concern

Copy link
Collaborator

@maloel maloel Dec 25, 2024

Choose a reason for hiding this comment

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

I would ask that we make error messages a little nicer, though: capitalization, e.g.:
LOG_ERROR( "Network adapter watcher termination failed: " << e.what() );
@Nir-Az up to you whether this is an error the user should see - we might want to leave it debug?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh OK

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure why not, @AviaAv can you handle please?

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.

3 participants