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

BugSnag.isStarted() implementation isn't thread safe #1795

Closed
jgreen210 opened this issue Jan 17, 2023 · 2 comments
Closed

BugSnag.isStarted() implementation isn't thread safe #1795

jgreen210 opened this issue Jan 17, 2023 · 2 comments

Comments

@jgreen210
Copy link

Describe the bug

The BugSnag.isStarted() implementation isn't thread safe: #1640 (comment)

See #883 too.

@johnkiely1
Copy link
Member

Hey @jgreen210,

Thanks for the suggestion.

A couple of points regarding the current implementation:

If isStarted returns true then getClient will not throw an exception, which is expected.
It is allowed to return false while start is in-flight.

Adding the lock would require isStarted to wait while start completes before returning, which is not always desirable. So is not something we would want to do.

@jgreen210
Copy link
Author

Adding the lock would require isStarted to wait while start completes before returning, which is not always desirable. So is not something we would want to do.

OK, but there is still a bug here. If you don't want to obtain the lock in isStarted, then could use an AtomicBoolean to ensure there's a memory barrier. It might also be possible to fix it some other way when fix #1731 (comment)

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

No branches or pull requests

2 participants