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
Renewal can commit a deadline that has already passed after a stall #47
Since #44, renew_orchestration_item_lock reads the time once, right after it gets the per-instance advisory lock. It uses that time for both the expiry check and the new deadline. If the session then stalls for longer than the extension before it commits, it commits a deadline that has already passed. Possible causes are CPU starvation, I/O, or a commit waiting on a synchronous standby.
This does not break ownership. Renewal holds the advisory lock until it commits, so no fetch can take the instance during the stall. After the commit, the old owner's acknowledge is still fenced on its token.
The cost is efficiency: the lease looks expired as soon as it is renewed, so another worker can take the instance at once and the turn runs twice. main has the same window.
Evidence
In the TLA+ model in #44 (docs/tla/orchestration-leases), RenewalDeadlineLiveAtCommit fails with zero clock skew in a 13-state trace. See the configurations MAIN-deadline-publication, PR43-deadline-publication and FIXED-deadline-publication.
Options
Compute the deadline from clock_timestamp() inside the final UPDATE, and raise if it is not later than the database clock; the provider then retries the renewal.
Document the window and leave the code as is. The stall would have to last longer than the extension (5 s by default) inside a single call.
A commit can always stall, so neither option removes the window completely. Low priority.
Activity