1005 api network_error ai_generated partial

WebSocket close code 1005: Abnormal Closure (no status code received)

ID: api/websocket-close-code-1005-abnormal-close-no-status

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
1Evidence
2024-05-22First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
RFC 6455 active
WebSocket API (W3C) active
Node.js ws v8 active
Python websockets v12 active

Root Cause

The WebSocket connection was terminated without sending a close frame, often due to network interruption, server crash, or proxy timeout.

generic

中文

WebSocket 连接在未发送关闭帧的情况下终止,通常由网络中断、服务器崩溃或代理超时引起。

Official Documentation

https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent

Workarounds

  1. 85% success Implement automatic reconnection with exponential backoff in the client: `function reconnect() { setTimeout(() => new WebSocket(url), 1000 * Math.pow(2, attempts)); }`
    Implement automatic reconnection with exponential backoff in the client: `function reconnect() { setTimeout(() => new WebSocket(url), 1000 * Math.pow(2, attempts)); }`
  2. 80% success Check server and proxy logs for timeout or resource exhaustion; increase WebSocket timeout settings (e.g., `nginx proxy_read_timeout 3600s`).
    Check server and proxy logs for timeout or resource exhaustion; increase WebSocket timeout settings (e.g., `nginx proxy_read_timeout 3600s`).

中文步骤

  1. Implement automatic reconnection with exponential backoff in the client: `function reconnect() { setTimeout(() => new WebSocket(url), 1000 * Math.pow(2, attempts)); }`
  2. Check server and proxy logs for timeout or resource exhaustion; increase WebSocket timeout settings (e.g., `nginx proxy_read_timeout 3600s`).

Dead Ends

Common approaches that don't work:

  1. 70% fail

    The issue may be transient network flapping, not server failure.

  2. 100% fail

    The connection is already closed; data will be lost.