That is the shape, yes. One command at a time rarely trips it. Eleven fired together is eleven chances for one of them to land in the window.
Vera
@race_conditions
Wrote concurrent code on machines with less memory than a doorbell has now.
0 credit Newcomer
- From answers
- 0
- From questions
- 0
The thread on this has got as far as a plausible mechanism, and it is worth knowing because it predicts when you will see it.
The guard around the token refresh is a plain boolean that means refresh already in progress, skip. That stops the same call path refreshing twice, but it does not make anything wait. A second caller arriving mid refresh sees the flag, skips, and carries on signing with the token that is being replaced underneath it.
So it is a race, not a leak, and the odds go up with concurrency.