Skip to content

Discord zombie WebSocket reconnect loop crashes gateway repeatedly #14703

Closed as not planned

Description

@swsmusic

Bug Description

Discord WebSocket connections that die overnight enter an infinite reconnect loop that crashes the entire gateway process, taking down all other channels (Telegram, etc.) with it.

Environment

  • OpenClaw version: 2026.2.9
  • Discord dependency: @buape/carbon 0.14.0
  • Platform: macOS (Mac Mini, always-on)
  • Node.js: 25.5.0

Reproduction

  1. Run gateway with Discord enabled (2 bot accounts)
  2. Wait for overnight network disruption or Discord-side WebSocket close
  3. Gateway enters reconnect death spiral

Observed Behavior

The Discord WebSocket connection dies (code 1005/1006) but the reconnect logic doesn't back off properly:

[discord] gateway: WebSocket connection closed with code 1005
[discord] gateway: Attempting resume with backoff: 1000ms
[discord] connection stalled: no HELLO received within 30000ms, forcing reconnect
[discord] gateway: Attempting resume with backoff: 1000ms
[discord] gateway: WebSocket connection closed with code 1006
[discord] gateway: WebSocket connection closed with code 1006
[discord] gateway: WebSocket connection closed with code 1005
[discord] gateway: Attempting resume with backoff: 1000ms
[discord] gateway: WebSocket connection closed with code 1005

In one session: 1,496 WebSocket closes and 1,301 resume attempts before manual intervention.

The uncaught exceptions from the zombie connection cause full gateway restarts. Each restart re-triggers the same dead connection, creating a crash loop. During this time:

  • Telegram polling times out repeatedly (500s timeouts, backoff up to 30s)
  • LLM requests on the main lane time out (298s+)
  • The system is effectively unusable

Expected Behavior

  • Exponential backoff on Discord reconnects (not fixed 1000ms)
  • Circuit breaker: after N failed reconnects, disable Discord channel gracefully without crashing the gateway
  • Zombie connection errors should be caught and handled, not thrown as uncaught exceptions
  • Other channels (Telegram, Slack) should not be affected by Discord connection issues

Related

Workaround

Currently disabling Discord via config and restarting the gateway when the loop is detected. Running a health monitor script that watches logs and auto-recovers.

Activity

  1. added
    bug
    on Feb 12, 2026
  2. sebslight commented on Feb 13, 2026

    @sebslight
    Contributor

    Closing as duplicate of #14331. If this is incorrect, comment and we can reopen.

  3. locked as resolved and limited conversation to collaborators on Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions