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

Race condition for _tick and _reported #57

Open
tovchenko opened this issue Dec 7, 2021 · 0 comments
Open

Race condition for _tick and _reported #57

tovchenko opened this issue Dec 7, 2021 · 0 comments

Comments

@tovchenko
Copy link

  1. Let assume that we use all the default callbacks and values.
  2. When the _ticker is not called during 5sec and we recognise this as ANR and send the report, assign interval initial value and set the _reported to true.
  3. We start our while cycle from the beginning: _tick is not 0 so we don't schedule _ticker again - it is ok, next we put our thread to the sleep on 5sec one more time.
  4. But imagine that our _ticker is not called again during this 5s but is called at the time when we step on condition "if (_tick != 0 && !_reported)" and it is race condition because we write and read _tick and _reported at the same moment of time.

Best,
Taras

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

1 participant