Repository navigation
fix(learning-dashboard): prevent actor crashes on missing activity state - #25272
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe PR makes three independent sets of changes. First, Second, the Third, breakout Playwright tests consolidate duplicated setup/verification patterns into eight new private helpers (audio modal closure, permission checking, lock viewers navigation, inherited breakout creation, join-as-moderator). Eight existing lock-settings test cases are rewritten to call these helpers, reducing duplication. A new 🎯 4 (Complex) | ⏱️ ~60 minutes Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/LearningDashboardActor.scala`:
- Around line 1063-1094: The code closes matching open sessions in the
`usersWithClosedPreviousSessions` mapping (lines 1068-1077), but when creating
`updatedUser` from the original `user` at lines 1079-1088, it rebuilds the
intIds without applying the same closure logic to `currentUserId`. When
`currentUserId` already has an open session, line 1087-1088 appends a new
UserSession without first closing the existing open one. Fix this by closing any
open session in `currentUserId` before appending the new UserSession, using the
same pattern as the `closeOpenSession` call within the
`usersWithClosedPreviousSessions` mapping.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e357131d-b5fa-449e-9395-37567a46191d
📒 Files selected for processing (1)
akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/LearningDashboardActor.scala
a0d754f to
10765a9
Compare
|
This pull request has conflicts ☹ |
The learning dashboard actor could crash when stop/leave/end events arrived without the corresponding in-memory activity item. For example, a webcam stop event could call `.last` on an empty webcam vector, throwing NoSuchElementException and restarting the actor. Since the actor keeps meeting dashboard data in memory, that restart caused active meetings to stop receiving dashboard updates. Guard learning dashboard message handling and report sending with NonFatal logging so one bad event or report failure does not restart the actor. Replace unsafe `.last`, `.init`, and `dropRight(1)` updates with `lastOption`-based handling and small helper methods for user session state transitions. Also refactor the touched logic for readability: - add helpers for open/flagged sessions and closing/reopening sessions - use explicit matches for presentation, away, webcam, and screenshare state - split user rejoin handling into named intermediate values - use `meetings.values.foreach(sendReportSafely)` for periodic reports Normal event behavior is preserved; the intentional behavior change is that missing or already-closed activity state now no-ops safely and logs failures instead of crashing the actor.
10765a9 to
c6472f9
Compare
Fix lock settings options was not showing inside breakouts for moderator. Fix and refactor lock settings tests in breakouts, create shared helpers that are used in multipe tests. Update some screenshots.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bigbluebutton-tests/playwright/breakout/create.ts`:
- Around line 8-15: The catch block in closeAudioModalIfPresent is too broad and
catches all errors, including legitimate failures like a failed click on the
close button. Narrow the exception handling to only wrap the first
page.locator(e.audioModal).waitFor call that checks for the visible state, which
is the operation expected to fail when the audio modal is not present. Move the
click operation on e.closeModal and the subsequent waitFor call for the detached
state outside and after the try-catch block, or into a separate try block, so
that actual failures in those operations propagate and are not silently masked
as expected behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b1d24cd1-bb6b-4e85-b233-8fce67dc54ed
⛔ Files ignored due to path filters (8)
bigbluebutton-tests/playwright/webcam/webcam.spec.ts-snapshots/drag-drop-areas-Chromium-linux.pngis excluded by!**/*.pngbigbluebutton-tests/playwright/webcam/webcam.spec.ts-snapshots/drag-drop-bottom-Chromium-linux.pngis excluded by!**/*.pngbigbluebutton-tests/playwright/webcam/webcam.spec.ts-snapshots/drag-drop-left-Chromium-linux.pngis excluded by!**/*.pngbigbluebutton-tests/playwright/webcam/webcam.spec.ts-snapshots/drag-drop-right-Chromium-linux.pngis excluded by!**/*.pngbigbluebutton-tests/playwright/webcam/webcam.spec.ts-snapshots/drag-drop-sidebar-bottom-Chromium-linux.pngis excluded by!**/*.pngbigbluebutton-tests/playwright/webcam/webcam.spec.ts-snapshots/drag-drop-top-Chromium-linux.pngis excluded by!**/*.pngbigbluebutton-tests/playwright/whiteboard/whiteboard.spec.ts-snapshots/mod-whiteboard-resize-initial-Chromium-linux.pngis excluded by!**/*.pngbigbluebutton-tests/playwright/whiteboard/whiteboard.spec.ts-snapshots/mod-whiteboard-resize-shrunk-Chromium-linux.pngis excluded by!**/*.png
📒 Files selected for processing (6)
bigbluebutton-html5/imports/ui/components/user-list/component.tsxbigbluebutton-html5/imports/ui/components/user-list/crowd-action-buttons/component.tsxbigbluebutton-html5/imports/ui/components/user-list/crowd-action-buttons/types.tsbigbluebutton-tests/playwright/breakout/create.tsbigbluebutton-tests/playwright/core/elements.tsbigbluebutton-tests/playwright/options/options.ts
💤 Files with no reviewable changes (1)
- bigbluebutton-html5/imports/ui/components/user-list/crowd-action-buttons/types.ts
✅ Files skipped from review due to trivial changes (1)
- bigbluebutton-tests/playwright/core/elements.ts
| private static async closeAudioModalIfPresent(page: PlaywrightPage) { | ||
| try { | ||
| await page.locator(e.audioModal).waitFor({ state: 'visible', timeout: ELEMENT_WAIT_TIME }); | ||
| await page.locator(e.closeModal).click(); | ||
| await page.locator(e.audioModal).waitFor({ state: 'detached', timeout: ELEMENT_WAIT_LONGER_TIME }); | ||
| } catch { | ||
| /* audio modal not present */ | ||
| } |
There was a problem hiding this comment.
Narrow the exception handling in closeAudioModalIfPresent.
At Line [13], catching all errors can mask real failures after the audio modal becomes visible (for example, failing to click close), which can produce false-positive test outcomes.
Proposed fix
private static async closeAudioModalIfPresent(page: PlaywrightPage) {
- try {
- await page.locator(e.audioModal).waitFor({ state: 'visible', timeout: ELEMENT_WAIT_TIME });
- await page.locator(e.closeModal).click();
- await page.locator(e.audioModal).waitFor({ state: 'detached', timeout: ELEMENT_WAIT_LONGER_TIME });
- } catch {
- /* audio modal not present */
- }
+ const audioModal = page.locator(e.audioModal);
+ const isAudioModalVisible = await audioModal
+ .isVisible({ timeout: ELEMENT_WAIT_TIME })
+ .catch(() => false);
+
+ if (!isAudioModalVisible) return;
+
+ await page.locator(e.closeModal).click();
+ await audioModal.waitFor({ state: 'detached', timeout: ELEMENT_WAIT_LONGER_TIME });
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private static async closeAudioModalIfPresent(page: PlaywrightPage) { | |
| try { | |
| await page.locator(e.audioModal).waitFor({ state: 'visible', timeout: ELEMENT_WAIT_TIME }); | |
| await page.locator(e.closeModal).click(); | |
| await page.locator(e.audioModal).waitFor({ state: 'detached', timeout: ELEMENT_WAIT_LONGER_TIME }); | |
| } catch { | |
| /* audio modal not present */ | |
| } | |
| private static async closeAudioModalIfPresent(page: PlaywrightPage) { | |
| const audioModal = page.locator(e.audioModal); | |
| const isAudioModalVisible = await audioModal | |
| .isVisible({ timeout: ELEMENT_WAIT_TIME }) | |
| .catch(() => false); | |
| if (!isAudioModalVisible) return; | |
| await page.locator(e.closeModal).click(); | |
| await audioModal.waitFor({ state: 'detached', timeout: ELEMENT_WAIT_LONGER_TIME }); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@bigbluebutton-tests/playwright/breakout/create.ts` around lines 8 - 15, The
catch block in closeAudioModalIfPresent is too broad and catches all errors,
including legitimate failures like a failed click on the close button. Narrow
the exception handling to only wrap the first page.locator(e.audioModal).waitFor
call that checks for the visible state, which is the operation expected to fail
when the audio modal is not present. Move the click operation on e.closeModal
and the subsequent waitFor call for the detached state outside and after the
try-catch block, or into a separate try block, so that actual failures in those
operations propagate and are not silently masked as expected behavior.
478c405 to
7989980
Compare
🚨 Automated tests failed |
7ba2ac8
into
bigbluebutton:v4.0.x-develop
|



What does this PR do?
Prevents
LearningDashboardActorfrom crashing when dashboard events arrive without the expected in-memory activity/session state.Learning dashboard changes include:
NonFatallogging..last,.init, and last-item vector updates withlastOption-based handling.Follow-up commits also:
Motivation
During a live meeting, learning dashboard data stopped updating because
LearningDashboardActorcrashed on an event with missing activity state.The crash happened when the actor tried to close a webcam entry using
.laston an empty webcam vector. Since the actor keeps active meeting dashboard data in memory, the actor restart lost the current state and left the dashboard data stale.The follow-up commits keep the v4 test environment aligned with the current interface.
More
The normal successful learning-dashboard event flow is preserved. The intentional behavior change is that missing or already-closed activity state now no-ops safely instead of throwing an exception and restarting the actor.