Skip to content

test: bound the stress tests and drop connections without sudo - #26105

Merged
ramonlsouza merged 1 commit into
bigbluebutton:v4.0.x-developfrom
antobinary:test-400-connection-drop-no-sudo
Oct 20, 2026
Merged

ramonlsouza merged 1 commit into
bigbluebutton:v4.0.x-developfrom
antobinary:test-400-connection-drop-no-sudo

Conversation

@antobinary

Copy link
Copy Markdown
Member

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" and connectionFailure "Screen share" and "Screen share viewer" no longer cut the TCP connection with sudo ss -K plus an iptables DROP rule. 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() gains drop(), routeGraphqlSockets().drop() returns how many sockets it closed, and a new routeServerConnection() combines the two so the tests can assert that they really cut something. killConnection(), connectionFailure/util.ts and checkRootPermission() are removed; nothing in the suite needs sudo any more.
  • The assertions follow the current client: the reconnection notice is a toast (toastSmallMsg "Reconnection in progress"), not the notification banner, and code 3001 is not in the default public.app.showConnectionErrors, so each test enables it for its own page through clientSettingsOverrides (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.
  • The stress tests replace 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

  • The OS-level kill needed passwordless sudo, so the four tests never ran in CI. ss -K dst <server> dport https also 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's sleep 1 left the DROP rule in place.
  • The assertions were stale: the banner text no longer exists, and "Code 1101. Try sharing the screen again." only comes from the bbb-webrtc-sfu screen share bridge; LiveKit, the default, resumes the share. The drop took effect, the tests failed anyway.
  • A stress test that got stuck never released its worker; one held a worker and nine audio pages for more than four hours.

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

cd bigbluebutton-tests/playwright
npx playwright test reconnection/ connectionFailure/

No sudo -v beforehand; 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 no sudo available to the tests.
  • --repeat-each 3 of 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.
  • The stress tests were not run; their only change is the timeout.
  • The suite's typecheck and prettier complaints (presentation/exportedAnnotationsOverlap.ts, core/page.ts, core/livekit.ts) pre-exist on v4.0.x-develop and 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

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.
@antobinary antobinary added this to the Release 4.0 milestone Oct 19, 2026
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2d7b6fff-1ff8-4868-884c-b39bb7b53d7c
📥 Commits

Reviewing files that changed from the base of the PR and between 3758c94 and 33bd553.

📒 Files selected for processing: 10
  • bigbluebutton-tests/playwright/connectionFailure/connectionFailure.spec.ts
  • bigbluebutton-tests/playwright/connectionFailure/util.ts
  • bigbluebutton-tests/playwright/core/elements.ts
  • bigbluebutton-tests/playwright/core/helpers.ts
  • bigbluebutton-tests/playwright/core/livekit.ts
  • bigbluebutton-tests/playwright/core/page.ts
  • bigbluebutton-tests/playwright/reconnection/reconnection.spec.ts
  • bigbluebutton-tests/playwright/reconnection/reconnection.ts
  • bigbluebutton-tests/playwright/reconnection/util.ts
  • bigbluebutton-tests/playwright/stress/stress.spec.ts
💤 Files with no reviewable changes: 2
  • bigbluebutton-tests/playwright/core/helpers.ts
  • bigbluebutton-tests/playwright/connectionFailure/util.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Walkthrough

Playwright 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
Loading
Merge Risk: ⚪ Minimal · up to 33bd5

The reconnection tests use page-local socket drops and check recovery. No issue requiring a fix before merge was identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly summarizes both primary changes: bounding stress-test timeouts and replacing sudo-based connection drops.
Description check Passed The description directly explains the connection-loss test changes, removal of sudo requirements, finite stress-test timeouts, testing results, and known scope limitations.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 8 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@ramonlsouza
ramonlsouza merged commit d7d5f52 into bigbluebutton:v4.0.x-develop Oct 20, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants