Skip to content

Slack socket-mode: orphaned ping intervals leak file descriptors and spam error log #56508

Description

@johnrtipton

Problem

When the gateway health monitor restarts a Slack socket-mode connection (reason: stale-socket), the @slack/[email protected] library has a race condition that can leave orphaned ping/pong intervals running.

What happens

  1. The health monitor detects a stale socket (no events for 30 min)
  2. It calls channelManager.stopChannel()abort()app.stop()
  3. app.stop() calls SocketModeClient.disconnect() which sets shuttingDown = true and sends a close frame
  4. Race: if the library's own ping timeout fires SlackWebSocket.disconnect() before shuttingDown is set, the close event handler sees shuttingDown === false and schedules a reconnect via delayReconnectAttempt(this.start)
  5. The orphaned ping interval (1.6s cycle) keeps firing on the dead socket, logging "A pong wasn't received from the server before the timeout of 5000ms!" indefinitely

Impact

  • gateway.err.log grew to 111MB from pong timeout warnings (~3 warnings every 1.6 seconds across 3 Slack accounts)
  • File descriptor accumulation over time (leaked websockets + intervals)
  • Contributes to system instability on long-running gateways

Environment

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