Repository navigation
test(relay): load generator can reopen a closed phone splice instead of failing the run - #27379
Conversation
…of failing the run (--splice-retry-max-seconds)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to The retry option may delay shutdown, or keep retrying past the intended duration when splices fail persistently. This only affects the opt-in load tool, but it should be resolved or explicitly accepted before merge. Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
83a8c2ae-766d-49d6-a8b6-c5ac2c7f9e66
📒 Files selected for processing (5)
cloud/dev/scripts/load-relay-controls.mjscloud/dev/scripts/relay-load-profile.mjscloud/dev/scripts/relay-load-splice-retry.mjscloud/dev/scripts/relay-load-splice-retry.test.mjscloud/package.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| holdMs: config.spliceHoldMs | ||
| }), | ||
| retryMaxMs: config.spliceRetryMaxMs, | ||
| stopping: () => state.stopping, |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Check whether the duration deadline changes state.stopping before Promise.all waits for retries.
rg -n -C 3 'state\.stopping\s*=|Promise\.all\(|splicePromises|durationMs' cloud/dev/scripts/load-relay-controls.mjs
sed -n '560,635p' cloud/dev/scripts/load-relay-controls.mjsRepository: stablyai/orca
Length of output: 4822
🏁 Script executed:
set -e
printf '%s\n' '--- imports and references ---'
rg -n -F --glob '*.mjs' -- 'runRelayLoadWithShutdown' cloud/dev
printf '%s\n' '--- declarations ---'
rg -n -F --glob '*.{mjs,js,ts}' -- 'function runRelayLoadWithShutdown' cloud dev
printf '%s\n' '--- candidate definitions ---'
rg -l -F --glob '*.{mjs,js,ts}' -- 'runRelayLoadWithShutdown' cloud dev | while read -r f; do
printf '\n--- %s ---\n' "$f"
rg -n -C 12 -F -- 'runRelayLoadWithShutdown' "$f"
doneRepository: stablyai/orca
Length of output: 818
🏁 Script executed:
set -e
printf '%s\n' '--- cloud/dev/scripts/relay-load-run-lifecycle.mjs ---'
nl -ba cloud/dev/scripts/relay-load-run-lifecycle.mjs | sed -n '1,180p'
printf '%s\n' '--- cloud/dev/scripts/relay-load-run-lifecycle.test.mjs ---'
nl -ba cloud/dev/scripts/relay-load-run-lifecycle.test.mjs | sed -n '1,180p'Repository: stablyai/orca
Length of output: 3558
🏁 Script executed:
set -e
printf '%s\n' '--- holdRelayLoadSplice references ---'
rg -n -F --glob '*.mjs' -- 'holdRelayLoadSplice' cloud/dev
printf '%s\n' '--- helper definition context ---'
file=$(rg -l -F --glob '*.mjs' -- 'export async function holdRelayLoadSplice' cloud/dev | head -n 1)
test -n "$file"
printf 'FILE=%s\n' "$file"
nl -ba "$file" | sed -n '1,220p'Repository: stablyai/orca
Length of output: 2732
Signal the run deadline independently of splice completion.
runRelayLoadWithShutdown invokes shutdown only after the operation resolves. A continuously failing splice therefore keeps retrying after config.durationMs, because state.stopping remains false. Set state.stopping from the duration timer.
🐛 Suggested fix
- await Promise.all([...splicePromises, delay(config.durationMs)])
+ const duration = delay(config.durationMs).then(() => {
+ state.stopping = true
+ })
+ await Promise.all([...splicePromises, duration])| } catch (error) { | ||
| if (stopping()) return undefined | ||
| onFailure(relayLoadSpliceFailureReason(error)) | ||
| await delay(Math.ceil(random() * retryMaxMs)) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Make the retry delay interruptible.
If stopping() becomes true during delay(), the splice promise remains pending until the full wait ends. With --splice-retry-max-seconds 300, shutdown can wait almost five additional minutes. Cancel the pending delay when the run stops, and test a stop that occurs during the delay.
… desktops do Without it the director's sticky lane is never reached, so a cell restart under load cannot exercise the sticky re-booking.
The load balancer keeps a dead backend's client websocket open, so a stopped cell's simulated hosts never noticed and never re-assigned.
ELI5
The relay load generator stops the whole run if a single simulated phone connection ("splice") closes. Real phones reconnect. This adds an opt-in flag so a closed splice reopens after a short random wait, the way the app retries, and the report counts those closes and how long each one took to come back.
What Changed
--splice-retry-max-seconds N(default 0). With 0 nothing changes: the first splice failure fails the run, as today, so existing proof profiles behave the same. With N > 0, a splice that closes or fails to open (a close code, an HTTP 429/503 on upgrade, or no active control because the control is reconnecting) retries after a random 0–N s wait until the run stops.spliceRetries,spliceFailuresByReason(closed_<code>,http_<status>,no_active_control,other), andspliceReopen(reopened, stillawaiting, p50/p95/max reopen time).relay-load-splice-retry.mjsplus its test, added to the cloud test list.Why
In the step-5 staging run, two base loads died at 02:48Z and 03:10Z: one splice got a 429 from a cell's per-source pre-auth limit, and another closed 1006. Both took down 600 controls with them. The e2e also needs phones held open across a cell's reserve/db flips, and that needs splices that reconnect. Leaving the default at 0 means no existing workflow or proof changes behaviour unless it passes the flag.
Linked Issue
N/A (maintainer; step-5 staging e2e follow-up).
Visual Proof
N/A: load-harness only.
Testing
relay-load-splice-retry(new; 5 tests),relay-load-profile,relay-load-run-lifecycleandrelay-load-control-peer: 58/58 pass.node --check load-relay-controls.mjs.Second change: reconnect flag. After a control has been established once, the simulated host now sends
reconnect: truewhen it asks for a new assignment. Real desktops already do this (relay-origin-pool.ts,relay-session-broker.ts). Without the flag the director never takes its sticky lane, so a cell restart under load could not test sticky re-booking (runbook §7 step 4 always readstickyReserves 0). A new peer test checks the flag is absent on the first assignment and present after a control is established.Third change: silence limit. A simulated host now closes its control after 75 s with no inbound frame. Desktops do the same (
relay-control-liveness.ts), and the cell pings every 15 s. When a cell's VM is deleted, the load balancer keeps the client websocket open (backend timeout 86400 s). Without this check, a stopped cell's simulated hosts never noticed and never re-assigned (runbook §8a). A new peer test uses fake timers.