Skip to content

Refactor RumAgent to avoid race condition#115

Merged
ambushwork merged 1 commit into
developfrom
yl/fix-rum-session-race-condition
Feb 12, 2026
Merged

Refactor RumAgent to avoid race condition#115
ambushwork merged 1 commit into
developfrom
yl/fix-rum-session-race-condition

Conversation

@ambushwork

Copy link
Copy Markdown
Member

Issue to fix

Before the race conditions happens when rumAgentLoop (running on task thread) try to create rumScope, while at the same time startView is called from BrightScript main thread, they enter in the if block ensureRumScope almost` the same time, causing two scopes are created, thus customers will see two session in the explorer, one containing only the first view with very short duration, the other is normal.

How this fix works

instead of directly triggering ensureRumScope from the thread of callsite, we send the event to the port of this task to which the task is always listening, once rumAgentLoop receives the event, it will be handled always in the task thread.

Additional Notes

Some other fix:

  • Remove periodic KeepAlive event in rumAgentLoop since it's a outdated concept
  • Fix a log

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@ambushwork
ambushwork requested a review from a team as a code owner February 11, 2026 16:08
@ambushwork
ambushwork force-pushed the yl/fix-rum-session-race-condition branch from 2415d19 to 6c62437 Compare February 11, 2026 16:10
Comment thread library/components/rum/RumAgent.xml
@ambushwork
ambushwork merged commit 916f6df into develop Feb 12, 2026
8 checks passed
@ambushwork
ambushwork deleted the yl/fix-rum-session-race-condition branch February 12, 2026 10:08
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