-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
When using the TestClock, the adjust (or more specifically, run) method synchronizes across fibers to only adjust when the system is at rest. However, due to this checking mechanism, two parallel adjusts will result in a livelock between the two freeze methods.
Reproduction:
import zio.*
import zio.test.*
object Test extends ZIOSpecDefault {
override def spec: Spec[TestEnvironment with Scope, Any] =
test("no problem on sequential calls")(
(TestClock.adjust(1.second) *> TestClock.adjust(1.second)).as(assertCompletes)
) + test("livelock on parallel calls")(
(TestClock.adjust(1.second) &> TestClock.adjust(1.second)).as(assertCompletes)
) @@ TestAspect.timeout(10.seconds)
}Metadata
Metadata
Assignees
Labels
No labels