Skip to content

[client] Fix browser relay WebSocket close and raise RDP dial timeout#6684

Merged
lixmal merged 1 commit into
mainfrom
wasm-client-fixes
Jul 9, 2026
Merged

[client] Fix browser relay WebSocket close and raise RDP dial timeout#6684
lixmal merged 1 commit into
mainfrom
wasm-client-fixes

Conversation

@lixmal

@lixmal lixmal commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Describe your changes

Fixes browser (WASM) client teardown and connection issues.

  • Close the relay WebSocket with a browser-valid close code and without blocking: the browser close API rejects the going-away code used by CloseNow, and waiting for the close handshake could block the relay teardown path
  • Raise the WASM RDP dial timeout from 15s to 30s to match the SSH dial timeout
  • Log expected state and profile file errors at debug instead of warn on js, where the filesystem is unavailable
  • Lower the lazy connection manager enablement log from warning to info now that it is enabled by default

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • This change does not modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — OR I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See CONTRIBUTING.md.

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (internal fix, no user-facing behavior change)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling when platform state APIs aren’t supported, using graceful fallbacks instead of warning-level failures.
    • Adjusted connection-related logging to be less noisy in supported environments.
    • Strengthened WebSocket teardown by using a dedicated close path for both browser and non-browser builds.
  • Performance
    • Increased the direct RDP dial timeout to improve connection reliability.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 359c55f1-5df3-4e4a-816d-4b5ed2401278

📥 Commits

Reviewing files that changed from the base of the PR and between f3b3f7c and 362d93e.

📒 Files selected for processing (7)
  • client/internal/conn_mgr.go
  • client/internal/profilemanager/service.go
  • client/internal/routemanager/manager.go
  • client/wasm/internal/rdp/rdcleanpath.go
  • shared/relay/client/dialer/ws/close_generic.go
  • shared/relay/client/dialer/ws/close_js.go
  • shared/relay/client/dialer/ws/conn.go
✅ Files skipped from review due to trivial changes (3)
  • shared/relay/client/dialer/ws/close_generic.go
  • client/internal/routemanager/manager.go
  • client/internal/conn_mgr.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • shared/relay/client/dialer/ws/conn.go
  • shared/relay/client/dialer/ws/close_js.go
  • client/wasm/internal/rdp/rdcleanpath.go
  • client/internal/profilemanager/service.go

📝 Walkthrough

Walkthrough

This PR adjusts log levels for feature-flag and state-restoration errors, increases the RDP dial timeout from 15s to 30s, and delegates websocket closing to platform-specific closeConn implementations for JS and non-JS builds.

Changes

Logging, Timeout, and Websocket Close Changes

Layer / File(s) Summary
ENOSYS-aware state restoration logging
client/internal/profilemanager/service.go, client/internal/routemanager/manager.go
Both files import syscall and now log syscall.ENOSYS state-load failures at debug level while other errors remain warnings.
Feature flag and RDP timeout tweaks
client/internal/conn_mgr.go, client/wasm/internal/rdp/rdcleanpath.go
Lazy connection manager feature-flag log changed from Warnf to Infof; rdpDialTimeout increased from 15s to 30s.
Platform-specific websocket close
shared/relay/client/dialer/ws/close_generic.go, shared/relay/client/dialer/ws/close_js.go, shared/relay/client/dialer/ws/conn.go
Adds closeConn() for non-JS and JS builds; Conn.Close() now delegates to closeConn().

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • netbirdio/netbird#6617: Also changes client/internal/conn_mgr.go’s ConnMgr.UpdatedRemoteFeatureFlag behavior.

Suggested reviewers: pappz

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: browser WebSocket close handling and the RDP timeout increase.
Description check ✅ Passed The description covers the changes, checklist, and documentation choice, but leaves the issue ticket and stack sections empty.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wasm-client-fixes

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

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Release artifacts

Built for PR head 362d93e in workflow run #16526.

Artifact Link
All release artifacts Download
Linux packages Download
Windows packages Download
macOS packages Download
UI artifacts Download
UI macOS artifacts Download

GHCR images (amd64)

This comment is updated by the Release workflow. Artifact links expire according to the workflow retention policy.

@lixmal
lixmal force-pushed the wasm-client-fixes branch from f3b3f7c to 362d93e Compare July 7, 2026 11:11
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

@theodorsm theodorsm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I assume TestResetAggregationWindow is a bit flaky and not related to this PR (I see other unrelated PRs also have this test fail).

@lixmal
lixmal merged commit 96ac15d into main Jul 9, 2026
44 of 46 checks passed
@lixmal
lixmal deleted the wasm-client-fixes branch July 9, 2026 11:21
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