Skip to content

WhatsApp watchdog reconnect loop: lastInboundAt persists across reconnects #59830

@bobbyt74

Description

@bobbyt74

Bug

The WhatsApp watchdog timer causes an infinite reconnect loop during quiet hours (night, weekends, etc.) when no messages are received for 30+ minutes.

Root Cause

In channel.runtime-Dto237Iv.js (the WhatsApp web channel runtime):

  1. MESSAGE_TIMEOUT_MS defaults to 30 minutes (1800s)
  2. When a connection starts, lastInboundAt is initialized from the previous connection's value (line ~2630: createActiveConnectionRun(status.lastInboundAt ?? status.lastMessageAt ?? null))
  3. After 30 min of silence, the watchdog kills the connection and forces a reconnect
  4. The new connection inherits the old lastInboundAt timestamp
  5. The watchdog immediately sees "30+ min since last message" and kills the connection again
  6. This creates an infinite reconnect loop

Expected Behavior

After a reconnect, the watchdog should give the new connection fresh time before considering it stale. The lastInboundAt should be reset (or the watchdog should use connection start time as baseline).

Proposed Fix

In createActiveConnectionRun(), reset lastInboundAt to null (or Date.now()) instead of inheriting the old value. This way the watchdog only triggers after 30 real minutes of silence on the new connection, not based on stale timestamps from the old one.

Workaround

Increase MESSAGE_TIMEOUT_MS to 4 hours (hotpatch the default from 1800 * 1e3 to 14400 * 1e3).

Affected File

dist/channel.runtime-Dto237Iv.js (built from the WhatsApp web channel monitor source)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions