Skip to content

chore (gql-middleware): Add more logs to clarify the reasons behind WebSocket disconnections from the browser and Hasura - #23347

Merged
antobinary merged 1 commit into
bigbluebutton:v3.0.x-releasefrom
gustavotrott:gql-middleware-disconnection-logs
Jun 11, 2025
Merged

antobinary merged 1 commit into
bigbluebutton:v3.0.x-releasefrom
gustavotrott:gql-middleware-disconnection-logs

Conversation

@gustavotrott

Copy link
Copy Markdown
Contributor

Add more INFO-level logs to clarify the reasons behind WebSocket disconnections from the browser and Hasura reconnections.

Previously, the logs contained only vague messages such as:

connected with Hasura
connected with Hasura
connected with Hasura
connection removed

Now, more descriptive logs are added beforehand, for example:

Reconnection request received for sessionToken: 0uonekvpyhp7y0v4, reason: assigned_presenter
connected with Hasura

Reconnection request received for sessionToken: xzbhdr5n3zpcwc7n, reason: assigned_presenter
connected with Hasura

Reconnection request received for sessionToken: xzbhdr5n3zpcwc7n, reason: lockSettings_changed
connected with Hasura

Browser disconnected voluntarily with status: StatusGoingAway (closed by the browser as the window was closed)
browser connection removed

Browser disconnected voluntarily with status: StatusNormalClosure
browser connection removed

Examples:

image

@gustavotrott gustavotrott added this to the Release 3.0 milestone Jun 9, 2025
@gustavotrott
gustavotrott requested a review from antobinary June 9, 2025 14:12
@coderabbitai

coderabbitai Bot commented Jun 9, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This set of changes updates log messages across several components of the codebase to provide more explicit context and appropriate log levels. In the Hasura connection reader, log messages for WebSocket closure events now specify "Hasura." In the web server's connection handler, log messages now explicitly mention "browser" connections. The browser WebSocket reader now differentiates between voluntary and other disconnections, logging additional information based on the WebSocket close status. Log levels for reconnection and disconnection events in both the reconnection handler and Redis client have been elevated from debug to info. No changes to exported entities or control flow were made.

Sequence Diagram(s)

sequenceDiagram
    participant Browser
    participant WebSrv_Reader
    participant Logger

    Browser->>WebSrv_Reader: Close WebSocket (with status)
    WebSrv_Reader->>WebSrv_Reader: Check error type
    alt Context canceled
        WebSrv_Reader->>Logger: Debug: Disconnected (context canceled)
    else WebSocket close
        alt Status: Going Away
            WebSrv_Reader->>Logger: Info: Browser closed window (Going Away)
        else Other close status
            WebSrv_Reader->>Logger: Info: Voluntary browser disconnection (status code)
        end
        WebSrv_Reader->>Logger: Debug: Disconnected
    end
Loading

Suggested reviewers

  • antobinary

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 39914a2 and 0b543e4.

📒 Files selected for processing (5)
  • bbb-graphql-middleware/internal/hasura/conn/reader/reader.go (1 hunks)
  • bbb-graphql-middleware/internal/websrv/connhandler.go (1 hunks)
  • bbb-graphql-middleware/internal/websrv/reader/reader.go (1 hunks)
  • bbb-graphql-middleware/internal/websrv/reconnectionHandler.go (1 hunks)
  • bbb-graphql-middleware/internal/websrv/rediscli.go (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-playback-record)
  • GitHub Check: build-package (bbb-config)
🔇 Additional comments (5)
bbb-graphql-middleware/internal/websrv/reconnectionHandler.go (1)

22-22: LGTM! Log level elevation improves operational visibility.

Changing from debug to info level is appropriate for reconnection events as these are important operational events that should be visible in standard logging configurations.

bbb-graphql-middleware/internal/hasura/conn/reader/reader.go (1)

35-35: LGTM! Message clarity improvement.

Adding "Hasura" prefix clearly identifies the connection type in logs, which is helpful when debugging issues involving multiple WebSocket connections.

bbb-graphql-middleware/internal/websrv/connhandler.go (1)

128-128: LGTM! Enhanced log specificity for browser connections.

Adding "browser" prefix to connection log messages improves clarity and helps distinguish between different connection types (browser vs. Hasura) when reviewing logs.

Also applies to: 131-131

bbb-graphql-middleware/internal/websrv/rediscli.go (1)

62-62: LGTM! Appropriate log level elevation for operational events.

Elevating reconnection and disconnection request logs from debug to info level ensures these important operational events are visible in standard logging configurations, improving monitoring and troubleshooting capabilities.

Also applies to: 73-73

bbb-graphql-middleware/internal/websrv/reader/reader.go (1)

41-49: Excellent enhancement for WebSocket disconnection insights!

This improvement provides valuable operational context by:

  • Distinguishing voluntary disconnections from other errors
  • Specifically identifying browser window closures (StatusGoingAway)
  • Maintaining technical debug information while adding user-friendly info logs

This significantly improves the ability to diagnose WebSocket disconnection causes, aligning perfectly with the PR objectives.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2025

Copy link
Copy Markdown

@ritzalam

ritzalam commented Jun 9, 2025

Copy link
Copy Markdown
Member

Thanks!

What does this mean? Does it really reconnect for certain events? Why?

Reconnection request received for sessionToken: xzbhdr5n3zpcwc7n, reason: lockSettings_changed
connected with Hasura

@github-actions

github-actions Bot commented Jun 9, 2025

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@gustavotrott

gustavotrott commented Jun 9, 2025 •

Copy link
Copy Markdown
Contributor Author

Thanks!

What does this mean? Does it really reconnect for certain events? Why?

Reconnection request received for sessionToken: xzbhdr5n3zpcwc7n, reason: lockSettings_changed
connected with Hasura

Regarding the reconnection logs, our architecture involves the following connection chain:
Browser → Middleware → Hasura

Whenever certain variables change—such as role, presenter, or lockSettings—the connection between Middleware and Hasura must be terminated and re-established. This is because Hasura sets these variables at the time the connection is established, so any update requires a reconnection to reflect the new values.
As a result, when lockSettings changes, for example, all viewers need to reconnect to Hasura. This process is transparent to the browser—the Middleware handles the reconnection internally without dropping the connection to the browser.

In short: It's normal and expected!

@antobinary
antobinary merged commit 97b6b71 into bigbluebutton:v3.0.x-release Jun 11, 2025
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.

3 participants