The Bay Lease That Expires Before Your Standby Wakes Up

The most dangerous line in a dock scheduling deployment is usually a reservation lease TTL that looks perfectly sensible on its own. It sits in one file, the failover detection window sits in another, and no reviewer holds both in their head at the same time. When the primary scheduler dies, every bay reservation can expire before the standby has promoted itself and replayed state. The standby then hands doors to new trailers while yard tractors are still reversing into them under the old assignment.

Why review never catches it

Each value passes review because each value is defensible. A lease TTL of 30 s keeps abandoned reservations from blocking doors when a trailer gets rerouted, and a conservative heartbeat policy keeps the HA manager from flapping on a congested yard network. The bug lives in the relationship between them: leases must outlive the time it takes to detect the failure, promote the standby and rebuild the reservation table from the event log. That is a cross-service invariant, and diffs only ever show one side of it. Someone tunes heartbeats for a noisy wireless segment, and someone else shortens the TTL to raise door utilisation. Both changes get approved, and the invariant breaks quietly months before anyone notices.

What the failure looks like on the apron

The standby comes up with a correct log and an empty set of live leases, because by its clock everything has expired, so it treats every door as free and starts allocating. Meanwhile the bay guidance controller on the tractor is still holding the precision reversing profile it was given for door twelve, and nothing has told it that door twelve now belongs to someone else. Cross-dock pallet synchronization makes it worse, since the outbound manifest for the reassigned door starts staging pallets on the same strip of floor the incoming trailer is about to back onto. Safety standards for driverless industrial trucks, ISO 3691-4 for example, will stop the tractor on its own obstacle detection, but that is the last line of defence, not a design. You get a near miss, a blocked door and a manual reconciliation that keeps the yard down far longer than the failover itself did.

A check you can run before the next deploy

Read the effective values from the running services, not from the repository: the scheduler's lease TTL, the HA manager's heartbeat interval multiplied by its missed beat threshold, the promotion timeout, and the worst observed replay duration from your last failover drill or from startup logs. Assert that the lease TTL exceeds the sum of those three by a margin you can defend, and fail the pipeline if it does not. The replay term is the one people skip, and it grows with log size, so a check that passed last quarter can fail today with no config change at all. As a rough estimate, replay on a busy cross-dock site can exceed the detection window by itself, which is why it belongs in the assertion and not in a footnote. Run the same comparison as a scheduled probe against production, because effective config drifts through feature flags and environment overrides that never reach code review.

The decision rule that keeps the yard safe when the scheduler fails is simple: if the guidance controller's last confirmed view of its lease is older than the lease TTL, it fails closed and halts the reversing manoeuvre until a live scheduler reconfirms the door, whatever the standby is saying.

Why not just make the lease TTL very long and avoid the race entirely?

Because a long TTL moves the cost elsewhere: doors stay locked by trailers that were rerouted or cancelled, and utilisation drops on exactly the busy shifts when you need it most. A better approach is to keep the TTL moderate and have the standby honour leases found in the replayed log for one full TTL after promotion, so it never starts from an empty table. That leaves you with a different trade-off. During that grace period the standby may hold doors for trailers that are already gone, and someone has to decide whether a few minutes of idle doors is cheaper than one reconciliation.

Back to V2Dock · Domains

← Back to V2Dock
Engineering & Architecture Brief

The Bay Lease That Expires Before Your Standby Wakes Up

The most dangerous line in a dock scheduling deployment is usually a reservation lease TTL that looks perfectly sensible on its own. It sits in one file, the failover detection window sits in another, and no reviewer holds both in their head at the same time. When the primary scheduler dies, every bay reservation can expire before the standby has promoted itself and replayed state. The standby then hands doors to new trailers while yard tractors are still reversing into them under the old assignment.

Why review never catches it

Each value passes review because each value is defensible. A lease TTL of 30 s keeps abandoned reservations from blocking doors when a trailer gets rerouted, and a conservative heartbeat policy keeps the HA manager from flapping on a congested yard network. The bug lives in the relationship between them: leases must outlive the time it takes to detect the failure, promote the standby and rebuild the reservation table from the event log. That is a cross-service invariant, and diffs only ever show one side of it. Someone tunes heartbeats for a noisy wireless segment, and someone else shortens the TTL to raise door utilisation. Both changes get approved, and the invariant breaks quietly months before anyone notices.

What the failure looks like on the apron

The standby comes up with a correct log and an empty set of live leases, because by its clock everything has expired, so it treats every door as free and starts allocating. Meanwhile the bay guidance controller on the tractor is still holding the precision reversing profile it was given for door twelve, and nothing has told it that door twelve now belongs to someone else. Cross-dock pallet synchronization makes it worse, since the outbound manifest for the reassigned door starts staging pallets on the same strip of floor the incoming trailer is about to back onto. Safety standards for driverless industrial trucks, ISO 3691-4 for example, will stop the tractor on its own obstacle detection, but that is the last line of defence, not a design. You get a near miss, a blocked door and a manual reconciliation that keeps the yard down far longer than the failover itself did.

A check you can run before the next deploy

Read the effective values from the running services, not from the repository: the scheduler's lease TTL, the HA manager's heartbeat interval multiplied by its missed beat threshold, the promotion timeout, and the worst observed replay duration from your last failover drill or from startup logs. Assert that the lease TTL exceeds the sum of those three by a margin you can defend, and fail the pipeline if it does not. The replay term is the one people skip, and it grows with log size, so a check that passed last quarter can fail today with no config change at all. As a rough estimate, replay on a busy cross-dock site can exceed the detection window by itself, which is why it belongs in the assertion and not in a footnote. Run the same comparison as a scheduled probe against production, because effective config drifts through feature flags and environment overrides that never reach code review.

The decision rule that keeps the yard safe when the scheduler fails is simple: if the guidance controller's last confirmed view of its lease is older than the lease TTL, it fails closed and halts the reversing manoeuvre until a live scheduler reconfirms the door, whatever the standby is saying.

Technical FAQ: Why not just make the lease TTL very long and avoid the race entirely?

Because a long TTL moves the cost elsewhere: doors stay locked by trailers that were rerouted or cancelled, and utilisation drops on exactly the busy shifts when you need it most. A better approach is to keep the TTL moderate and have the standby honour leases found in the replayed log for one full TTL after promotion, so it never starts from an empty table. That leaves you with a different trade-off. During that grace period the standby may hold doors for trailers that are already gone, and someone has to decide whether a few minutes of idle doors is cheaper than one reconciliation.

Related Architecture Specifications (AUTOMOTIVEV2X): v2orchestration.com · v2sensor.com · v2uav.com

More Technical Articles on v2dock.com

Eliminating Warehouse Dwell Times: Real-World Case Study of Connected Distribution Centers →Kinematic Control Models for Blind Reversing in Tight Warehouse Bays →The Bay Lease That Expires During Failover →The Dock Reservation That Outlives Its Owner →