Skip to content

Discord health-monitor stale-socket reconnect crashes gateway (maxReconnectAttempts=0) #55232

Closed as not planned

Description

@coolmanns

Summary

When the Discord health-monitor detects a stale socket and attempts reconnection, the gateway crashes with an uncaught exception because maxReconnectAttempts is 0. This is a fatal crash that brings down the entire gateway, not just the Discord channel.

Reproduction

Observed on v2026.3.24 stable. Happens whenever the Discord WebSocket goes stale.

[health-monitor] [discord:default] health-monitor: restarting (reason: stale-socket)
[openclaw] Uncaught exception: Error: Max reconnect attempts (0) reached after code 1005
    at SafeGatewayPlugin.handleReconnectionAttempt (file:///...dist/provider-CAlWEl41.js:3318:47)

Gateway systemd service restarts, but this triggers delivery-recovery batch flush (#55231) and disrupts all channels — not just Discord.

Expected behavior

  • maxReconnectAttempts=0 should either be treated as "unlimited" or use a sensible default (e.g. 5)
  • A single channel's reconnect failure should never crash the entire gateway — isolate the failure to that channel
  • If reconnection truly fails, log an error and disable the channel gracefully

Environment

  • OpenClaw v2026.3.24 stable
  • Ubuntu, systemd service
  • Discord channel configured with default settings (no explicit maxReconnectAttempts set)

Activity

  1. coolmanns commented on Mar 26, 2026

    @coolmanns
    ContributorAuthor

    Update: This is NOT a regression in v2026.3.24 — confirmed happening on v2026.3.23 as well.

    The Discord stale-socket → crash cycle has been running approximately every 35 minutes since at least Mar 25 afternoon (pre-upgrade). Sample from journalctl:

    Mar 25 17:43:52 — Max reconnect attempts (0) reached after code 1005
    Mar 25 18:18:59 — stale-socket → crash
    Mar 25 18:54:06 — stale-socket → crash
    Mar 25 19:29:13 — stale-socket → crash
    Mar 25 20:04:20 — stale-socket → crash
    Mar 25 20:54:27 — stale-socket → crash
    Mar 25 21:29:34 — stale-socket → crash
    Mar 25 22:04:41 — stale-socket → crash (pre-upgrade, v2026.3.23)
    

    ~35 minute interval = health-monitor check interval. Every check finds a stale socket, tries to reconnect, and crashes the gateway because maxReconnectAttempts=0.

    systemd restart counter was at 39 as of this morning — this bug is the primary source of gateway restarts.

  2. coolmanns commented on Mar 26, 2026

    @coolmanns
    ContributorAuthor

    Duplicate of #54729 — same bug, same stack trace, confirmed pre-existing on v2026.3.23. Adding our data as a comment on that issue.

  3. coolmanns commented on Mar 26, 2026

    @coolmanns
    ContributorAuthor

    Closing as duplicate of #54729

  4. locked as resolved and limited conversation to collaborators on Mar 29, 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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions