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
Fix a bug that could leave the coroutine scheduler's PRNG in an invalid state (#4052)
A potential bug is fixed, where `nextInt` would always return zero due to incorrect initialization of rngState with zero.
This could happen during the creation of a worker with thread id = `1595972770` (JDK >=8), or unpredictable if fallback thread-local random is used (android SDK <34 or JDK <7), approximate probability is 2.4E-10
Also, this slightly optimizes the performance of coroutines initialization. During the creation of `CoroutineScheduler.Worker`, we need to initialize its embedded random number generator.
To avoid additional class-loading costs (#4051), `rngState` is now directly initialized from the current nanoTime (that is used as seed).
Fixes#4051
Co-authored-by: Vsevolod Tolstopyatov <[email protected]>
0 commit comments