openclaw - 💡(How to fix) Fix [Bug]: WebSocket handshake-timeout on reconnect causes Control UI to stay disconnected for minutes (nginx reverse proxy) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#73631Fetched 2026-04-29 06:17:11
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Timeline (top)
closed ×1commented ×1

After a browser refresh (or any WebSocket reconnect), the Control UI stays disconnected for several minutes while the client retries. Each WebSocket handshake attempt fails with handshake-timeout (12–63 seconds per attempt) before eventually succeeding.

Error Message

[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=12688 durationMs=16859 code=1000 [gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=14107 durationMs=18924 code=1000 [gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=11326 durationMs=15807 code=1000 [gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=10420 durationMs=14249 code=1000 [gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=13307 durationMs=16920 code=1000 [gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=12157 durationMs=17378 code=1000 [gateway/ws] WARN closed before connect cause=handshake-timeout durationMs=63331 code=1000 ← 63s!

Root Cause

After a browser refresh (or any WebSocket reconnect), the Control UI stays disconnected for several minutes while the client retries. Each WebSocket handshake attempt fails with handshake-timeout (12–63 seconds per attempt) before eventually succeeding.

Code Example

[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=12688 durationMs=16859 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=14107 durationMs=18924 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=11326 durationMs=15807 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=10420 durationMs=14249 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=13307 durationMs=16920 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=12157 durationMs=17378 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout durationMs=63331 code=1000  ← 63s!
[gateway/ws] INFO webchat connected  ← success after ~6 minutes
RAW_BUFFERClick to expand / collapse

Summary

After a browser refresh (or any WebSocket reconnect), the Control UI stays disconnected for several minutes while the client retries. Each WebSocket handshake attempt fails with handshake-timeout (12–63 seconds per attempt) before eventually succeeding.

Environment

  • OpenClaw version: 2026.4.26
  • OS: Linux VPS (Ubuntu), client: Chrome/macOS
  • Setup: OpenClaw on loopback (127.0.0.1:18789), nginx reverse proxy at custom domain
  • Not Docker

Steps to Reproduce

  1. Open Control UI → connected and working
  2. Refresh the page (F5 or browser reload)
  3. Watch the UI show disconnected state

Expected: Reconnects within 1–2 seconds. Actual: Stays disconnected for 1–6+ minutes while retrying. 15+ failed handshake attempts observed in one window.

Gateway Logs

Pattern observed between 14:51–14:57 UTC (page refresh at ~14:51):

[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=12688 durationMs=16859 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=14107 durationMs=18924 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=11326 durationMs=15807 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=10420 durationMs=14249 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=13307 durationMs=16920 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout handshakeMs=12157 durationMs=17378 code=1000
[gateway/ws] WARN closed before connect cause=handshake-timeout durationMs=63331 code=1000  ← 63s!
[gateway/ws] INFO webchat connected  ← success after ~6 minutes

Notes

  • Seems worse when gateway is under load (multiple long-running sessions active)
  • nginx config has standard proxy_read_timeout / proxy_send_timeout (86400s) for WebSocket upgrade
  • Related: #73421 (similar stalls in Docker/NAS, post-2026.4.26 regression)

extent analysis

TL;DR

Adjusting the WebSocket handshake timeout or optimizing the gateway's performance under load may help resolve the reconnect issue.

Guidance

  • Investigate the gateway's performance under load and consider optimizing it to reduce the reconnect time.
  • Review the WebSocket handshake timeout configuration and consider adjusting it to a lower value to prevent prolonged reconnect attempts.
  • Verify that the proxy_read_timeout and proxy_send_timeout settings in the nginx config are properly configured for WebSocket connections.
  • Check if the issue is related to the post-2026.4.26 regression mentioned in #73421 and consider applying any available fixes or workarounds.

Example

No code snippet is provided as the issue seems to be related to configuration and performance rather than code.

Notes

The issue may be specific to the OpenClaw version (2026.4.26) and the Linux VPS environment. Further investigation is needed to determine the root cause and apply a suitable fix.

Recommendation

Apply workaround: Adjust the WebSocket handshake timeout and optimize the gateway's performance under load, as the issue seems to be related to performance and configuration rather than a specific version bug.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: WebSocket handshake-timeout on reconnect causes Control UI to stay disconnected for minutes (nginx reverse proxy) [1 comments, 2 participants]