Repository navigation
test: bound the stress tests and drop connections without sudo - #26105
ramonlsouza merged 1 commit into
Conversation
The stress tests called test.setTimeout(0), so a stress test that got stuck never released its worker and the run could never finish. On 2026-10-03 "Join 2 users (mod and attendee) keeping the previous one connected" held a worker and nine audio pages for more than four hours. Each stress test now has a finite timeout, so a hang fails the test and frees the worker. The values are about three times the longest duration measured with other test runs loading the same server: 15 minutes for "First moderator joining as presenter", "Join 2 users" and "keeping the previous one connected" (78 s, 102 s and 47 s in the 2026-10-03 run; 3.2, 5.2 and 4.3 minutes under load) and 45 minutes for "exceeding max participants limit" (5.5 minutes, 14.3 under load). The breakout test is fixme and does not run, so its 15 minutes are an estimate. The four connection-loss tests (Reconnection "Chat" and "Audio", Connection failure "Screen share" and "Screen share viewer") cut the connection with sudo ss -K and an iptables DROP rule on the machine running the tests. That needed passwordless sudo, so they never ran in CI. The reconnection helper's "ss -K dst <server> dport https" cut every connection from the machine to the server, including the other worker's; on 2026-10-03 a recording test in the other worker failed that way. The DROP rule was removed by a later line of the same shell snippet, so a kill during its one-second sleep left the server unreachable. All four now drop the page's own graphql websocket and LiveKit signal socket from inside the browser through Playwright's WebSocket routing, as the hidden-presentation reconnection test already does for graphql. The client sees the same close it sees on a network drop, waits and reconnects on new sockets, which pass through. Only that page is affected, so nothing needs root and the other worker keeps its connections. Every scenario could be expressed this way, so no test keeps the OS-level drop, and killConnection(), connectionFailure/util.ts and checkRootPermission() are removed. routeLiveKitSignal() gains a drop() for this, and routeGraphqlSockets().drop() returns how many sockets it closed, so the tests assert that they really cut something. The assertions were stale as well, which is why all four failed whenever they ran, although the drop took effect (the chat input was disabled in the failure snapshots). The client no longer shows connection errors in the notification banner but in a toast, and the "Connecting ..." banner text no longer exists. Code 3001, "Reconnection in progress", is left out of the default public.app.showConnectionErrors. "Code 1101. Try sharing the screen again." only comes from the bbb-webrtc-sfu screen share bridge; LiveKit, the default, resumes the share. The tests now enable 3001 for their own page through clientSettingsOverrides, which now accepts arrays, and wait for the reconnecting toast to appear and go away. Then they check what should have recovered: the chat input, disabled while offline, is enabled again and sends a message; the microphone is still connected and capturing; the presenter is still sharing and the viewer still sees the share; a viewer whose own connection dropped sees the share again. Killing the page's TCP sockets with ss -K gives the same toast and the same recovery. "Chat", "Audio" and "Screen share viewer" passed all 11 runs on a 4.0 server, including 5 of 5 with --repeat-each 5, 3 with chat/ running in the other worker and one in CI mode, so they are tagged @ci. "Screen share" passed 9 of 10 and is not tagged. The client reconnects graphql 10 s after a drop, and akka's audit, every 10 s, removes a user whose connections have been closed for more than 10 s. When the audit runs first, the presenter role is reassigned and the share stops for everyone while the presenter's client still shows "Stop sharing your screen". That is a product race, not a test fault, so the assertion stays and the test stays out of the per-PR gate until the race is fixed. On the bbb-webrtc-sfu bridge only the graphql socket is dropped, so that bridge's 1101 path is no longer covered.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughPlaywright reconnection tests now route GraphQL and LiveKit signal connections through the browser and close them to test reconnection behavior. The tests check reconnecting-toast visibility and removal, then verify chat or screen-sharing behavior. Root-permission checks and host-level TCP termination utilities were removed. Stress tests now set timeouts on individual tests instead of disabling timeouts for the suite. Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Other Sequence Diagram(s)sequenceDiagram
participant PlaywrightTest
participant BrowserPage
participant ServerConnection
participant GraphqlSockets
participant LiveKitSignalRoute
participant ReconnectingToast
PlaywrightTest->>BrowserPage: routeServerConnection(page)
BrowserPage-->>PlaywrightTest: ServerConnection
PlaywrightTest->>ServerConnection: drop()
ServerConnection->>GraphqlSockets: drop open GraphQL sockets
ServerConnection->>LiveKitSignalRoute: drop open signal sockets
BrowserPage-->>ReconnectingToast: show reconnecting toast
PlaywrightTest->>ReconnectingToast: check toast visibility and removal
Merge Risk: ⚪ Minimal · up to
|
✅ Automated tests have passed! |
What does this PR do?
Makes the four connection-loss tests run without root and against the current client, and gives the stress tests a finite timeout.
reconnection"Chat" and "Audio" andconnectionFailure"Screen share" and "Screen share viewer" no longer cut the TCP connection withsudo ss -Kplus an iptablesDROPrule. They close the page's own graphql websocket and LiveKit signal socket from inside the browser through Playwright's WebSocket routing, the mechanism the hidden-presentation reconnection test already uses for graphql. The client sees the same close it sees on a network drop, waits and reconnects on new sockets, which pass through. Only that page is affected.routeLiveKitSignal()gainsdrop(),routeGraphqlSockets().drop()returns how many sockets it closed, and a newrouteServerConnection()combines the two so the tests can assert that they really cut something.killConnection(),connectionFailure/util.tsandcheckRootPermission()are removed; nothing in the suite needs sudo any more.toastSmallMsg"Reconnection in progress"), not the notification banner, and code 3001 is not in the defaultpublic.app.showConnectionErrors, so each test enables it for its own page throughclientSettingsOverrides(which now accepts arrays). After the toast appears and goes away the tests check what should have recovered: the chat input is enabled again and sends a message; the microphone is still connected and capturing; the presenter is still sharing and the viewer still sees the share; a viewer whose own connection dropped sees the share again.test.setTimeout(0)with 15 minutes (45 for "exceeding max participants limit"), about three times the longest duration measured for each on a loaded server, so a hang fails the test instead of holding the worker.Why
ss -K dst <server> dport httpsalso killed every connection from the machine to the server, including the other worker's (a recording test in the other worker failed that way), and a kill during the snippet'ssleep 1left theDROPrule in place.Tags
"Chat", "Audio" and "Screen share viewer" are tagged
@ci. "Screen share" is not: the client reconnects graphql 10 s after a drop and akka's audit, every 10 s, removes a user whose connections have been closed for more than 10 s. When the audit runs first, the presenter role is reassigned and the share stops for everyone while the presenter's client still shows "Stop sharing your screen". That is a product race, not a test fault, so the assertion stays and the test stays out of the per-PR gate until the race is fixed. On the bbb-webrtc-sfu bridge only the graphql socket is dropped, so that bridge's 1101 path is no longer covered.How to test
No
sudo -vbeforehand; the tests skip nothing.Testing
On a 4.0.x-develop server (LiveKit bridge, Chromium, 2 workers), 2026-10-19:
npx playwright test reconnection/ connectionFailure/: 9 passed in 1.6 min (the four rewritten tests plus the other specs in those directories), with nosudoavailable to the tests.--repeat-each 3of the four rewritten tests: 12 of 12 passed in 2.4 min. "Screen share" passed 4 of 4 in these runs; the race described above did not strike here.presentation/exportedAnnotationsOverlap.ts,core/page.ts,core/livekit.ts) pre-exist onv4.0.x-developand are not touched here.The video is Playwright's own recording (
video: 'on') of the four rewritten tests from the first run: a title card per test, then the page recordings. The "Reconnection in progress (code 3001)" toast is the drop taking effect; what follows it is the recovery check.01-connection-drop-tests-run.mp4:
01-connection-drop-tests-run.mp4