You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During my work on #3641 and debugging internal-API specific tests, I've stumbled across the scenario (currently reproducible only with CoroutineSchedulerInternalApiStressTest with last lines uncommented) where controlState overflows and interfere with CPU tokens control mechanism.
The bug seemed to be here nearly since the very beginning and should be assessed and investigated without the use of IDEA-only internal API. The potential impact is unclear
The text was updated successfully, but these errors were encountered:
Previously, an arbitrary task was added to the scheduler's queue and the corresponding counter was incremented. The actual executing thread decremented the counter as soon as the task was done, meaning that, if timings are unlucky enough, the overall balance of blocking tasks could've been negative.
The second part of the equation is that all increments are atomic (instead of being CAS-based), meaning that due to programmatic bugs like the previous one, it's easy to overstep the boundary of adjacent masks, leaving the state in an inconsistent state.
Fix is trivial -- increment counter before publishing, do not reset it if the scheduler is closed and task wasn't added.
Fixes#3642
Previously, an arbitrary task was added to the scheduler's queue and the corresponding counter was incremented. The actual executing thread decremented the counter as soon as the task was done, meaning that, if timings are unlucky enough, the overall balance of blocking tasks could've been negative.
The second part of the equation is that all increments are atomic (instead of being CAS-based), meaning that due to programmatic bugs like the previous one, it's easy to overstep the boundary of adjacent masks, leaving the state in an inconsistent state.
Fix is trivial -- increment counter before publishing, do not reset it if the scheduler is closed and task wasn't added.
Fixes#3642
During my work on #3641 and debugging internal-API specific tests, I've stumbled across the scenario (currently reproducible only with
CoroutineSchedulerInternalApiStressTest
with last lines uncommented) wherecontrolState
overflows and interfere with CPU tokens control mechanism.The bug seemed to be here nearly since the very beginning and should be assessed and investigated without the use of IDEA-only internal API. The potential impact is unclear
The text was updated successfully, but these errors were encountered: