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
{{ message }}
Repository navigation
durable: a host read of the instance clock during a step is journaled but can't be replayed #247
state.Instance.Clock() is exported. A durable Handle's instance uses the Handle's recording clock, so when host code reads it during a step, for example an action that calls h.Instance().Clock().Now(), the read is journaled with the step's own. Recover can't make that read again: no Handle exists during replay, so the host code can't reach the replay clock. Each later replayed read then takes the reading after the one it should have, and the timers that step and later steps arm come back at the wrong deadlines.
Reproduction:TestRecover_ReplaysAStepWhoseHostCodeReadTheInstanceClock in durable/chained_deadline_internal_test.go (skipped with a pointer to this issue). An action on the transition into a timed state reads the instance clock. Live, the timer is armed at 1.001s. After Recover, it's armed at 1.000s.
Possible fix
The kernel never reads the clock; only the Scheduler does, and it takes the instance's clock. Give the scheduler durable's recording clock, and the instance an unrecorded one for host code, through an additive state option such as NewScheduler(inst, WithSchedulerClock(c)). Host reads are then not journaled, and replay stays aligned whatever host code reads.
Context: found while reviewing #234. It predates #234, and isn't one of #214's items.
Activity
fix(durable): don't rerun a compound state's settled invoke after Rec…
fix(durable): don't journal a step whose context ended partway (#234)