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
Had a production incident because Cache#get was hanging forever. Finally found the culprit: when get is interrupted, there is a possibility for it to be interrupted before onInterrupt is set but after the map is updated with the Pending state. In that case it stays Pending until the cache is invalidated.
Reproducer:
test("ensure get is not hanging when we interrupt right after a get in another fiber") {
for {
cache <-Cache.make(10, Duration.Infinity, Lookup((_: Unit) =>ZIO.succeed(1)))
task1 = (cache.invalidate(()) *> cache.get(())).fork.flatMap(_.interrupt)
_ <-ZIO.forkAll(List.fill(1000)(task1))
_ <- cache.get(()).exit.timeoutFail("hanging")(3.seconds).forever.timeout(7.seconds)
} yield assertCompletes
} @@TestAspect.withLiveClock
The text was updated successfully, but these errors were encountered:
Had a production incident because
Cache#get
was hanging forever. Finally found the culprit: whenget
is interrupted, there is a possibility for it to be interrupted beforeonInterrupt
is set but after the map is updated with thePending
state. In that case it staysPending
until the cache is invalidated.Reproducer:
The text was updated successfully, but these errors were encountered: