[BUG] Baileys session stops receiving inbound messages while dashboard still shows "Connected" — requires full container restart to recover

未关闭
#2,790 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
docker, postgresql, redis, typescript
领域
api, backend, databases

调研方向

Start by tracing the Baileys session lifecycle and the ChannelStartupService connection logs; the payload does not name source files or tests. Compare how inbound message events update the chat/message store with how outbound sends and the dashboard connection status are reported. The issue is resolved when inbound messages resume reliably after recovery and the reported status reflects a stalled session.

由索引模型根据 Issue 内容生成。

描述

bug
📋 Bug Description

The WhatsApp (Baileys) session silently stops receiving new inbound messages while the Evolution Manager dashboard and the instance status both continue to report "Connected". Outbound sends (messages triggered by our own automation via the API) continue to work normally during the stall, which masks the problem and makes it hard to detect from the dashboard alone. The only reliable fix found so far is a full restart of the evolution-api container (not the in-app “Restart”/”Disconnect” buttons in Evolution Manager, which do not recover the session once it’s already stalled).

🔄 Steps to Reproduce

This appears to happen spontaneously after some hours of uptime (not tied to a specific user action). Observed recurrence: 3 times in under 48 hours.

Instance connects normally and processes inbound/outbound messages for some hours.
At some point, inbound messages stop being written to the instance’s message/chat store (findChats / findMessages), even though:
The dashboard still shows the instance as "Connected".
Outbound messages sent via our own API calls are still delivered and logged correctly (fromMe: true records keep appearing).
Using Evolution Manager’s own in-app “Restart” and “Disconnect” buttons does not recover message reception.
A full restart of the underlying Docker container (outside Evolution Manager, at the hosting/orchestration level) does recover it — confirmed via a new [ChannelStartupService] CONNECTED TO WHATSAPP log line and fresh inbound messages syncing in afterward.
The issue recurred again ~16.5 hours after the first fix, and a third time a few hours after the second restart — this time, even after the container restart logged CONNECTED TO WHATSAPP, inbound sync did not resume at all (verified directly against the instance’s own chat/message database: the most recently updated chat across the entire instance remained stuck ~9+ hours in the past, with zero new records, despite test messages sent and outbound automation continuing to fire).

✅ Expected Behavior

The instance should either genuinely reflect a disconnected/degraded state (not "Connected") when the Baileys session stops receiving events, so monitoring can catch it, and/or
The in-app Restart/Disconnect actions should reliably force a real reconnect without requiring an external container restart, and/or
A full container restart should reliably restore inbound message reception (this was not the case the third time).

❌ Actual Behavior

The Baileys session stops receiving new inbound WhatsApp messages while the instance dashboard and status endpoint still report "Connected". Outbound messages sent via our own API/automation continue to work and get logged normally (fromMe: true records keep appearing), which masks the failure.

Confirmed directly against the instance’s own database (/chat/findChats and /chat/findMessages): the most recently updated chat across the entire instance was stuck more than 9 hours in the past, with zero new inbound records, even though test messages were sent during that window and outbound automation kept firing normally.

Evolution Manager’s own in-app “Restart” and “Disconnect” buttons did not recover inbound reception. A full restart of the underlying Docker container did recover it the first time (new [ChannelStartupService] CONNECTED TO WHATSAPP log line, followed by inbound messages syncing again), but on a later occurrence, even a full container restart with that same “CONNECTED TO WHATSAPP” log line did not restore inbound message reception — the instance kept reporting “Connected” with zero new inbound activity afterward.

This has now happened 3 times in under 48 hours.

🌍 Environment

Evolution API, self-hosted via Docker (EasyPanel), with Postgres + Redis.
WhatsApp connector: Baileys, version observed in logs: 2.3000.1054337431.
Instance driven by n8n via real-time Webhook + a periodic flush/schedule trigger.

📋 Logs

📝 Additional Context

Happy to share more detailed timestamps/logs if useful — this is a production instance for a small business’s customer-service WhatsApp bot, so the silent nature of the failure (dashboard shows healthy) is the most damaging part, since it delays detection.

主要语言
TypeScript
星标
10.2k
派生
7.5k
平均合并
6 天 19 小时
30 天内合并 PR
4

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

evolution-foundation/evolution-api 的其他 Issue

查看 evolution-foundation/evolution-api 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。