PostgreSQL connections are not released after QR/reconnect failures
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
调研方向
首先,在监控 Evolution GO 容器中的 PostgreSQL 连接时,复现 QR、重新连接和会话初始化失败流程。检查这些流程涉及的数据库路径,以及 evolution-client.ts 和 functions/evolution-send-text/index.ts,以调查报告中的发送失败问题;当失败尝试不再累积空闲连接或耗尽 max_connections 时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Welcome!
- Yes, I have searched for similar issues on GitHub and found none.
What did you do?
I am running Evolution GO in Docker with PostgreSQL 15 on Linux.
Environment summary:
- evolution-go: 0.7.2
- Docker image: evoapicloud/evolution-go:0.7.2
- PostgreSQL 15
- standalone Docker Compose deployment
I have 2 WhatsApp instances.
After QR generation / reconnect attempts, the application started failing to reconnect properly. During investigation, I checked PostgreSQL activity and noticed a large number of idle connections coming from the Evolution GO container, especially against the auth database.
At one point, PostgreSQL reached the connection limit and Evolution GO started failing on QR and send flows.
Restarting only the evolution-go container released those connections and the QR flow started working again.
This looks like database connections may not be properly released after failed initialization or reconnect attempts.
What did you expect?
I expected Evolution GO to reuse or release PostgreSQL connections correctly during QR generation, reconnect attempts, and failed session initialization.
Even if an instance fails to reconnect, the application should not keep accumulating idle database connections until PostgreSQL reaches max_connections.
What did you observe instead of what you expected?
Instead, PostgreSQL connections kept accumulating as idle connections from the Evolution GO container.
After enough reconnect / QR attempts, PostgreSQL started returning connection limit errors and Evolution GO stopped working correctly.
Observed effects:
- QR code endpoint failed
- send flows failed
- instance/session state became inconsistent
- application logs later showed "no active session found"
The issue was temporarily resolved by restarting only the evolution-go container, which immediately reduced the number of open PostgreSQL connections.
Screenshots/Videos
I can provide:
- screenshots of the disconnected instance state
- QR refresh failure
- logs showing "no active session found"
- PostgreSQL connection counts before and after restarting the container
Which version are you using?
0.7.2
Docker image: evoapicloud/evolution-go:0.7.2
PostgreSQL 15
What is your environment?
Linux
If applicable, paste the log output
Initial related error:
failed to upgrade database: failed to check if version table is up to date: pq: sorry, too many clients already
Later application error:
Erro ao enviar texto: Error: no active session found
at request (.../functions/_shared/evolution-client.ts:404:13)
at async Server. (.../functions/evolution-send-text/index.ts:50:20)
Database observation:
- max_connections: 100
- idle connections reached: 99 for the auth database
- after restarting only the evolution-go container, connections dropped back to normal
Additional Notes
This report is based on repeated behavior in production.
I cannot fully confirm yet whether this is an upstream bug or an environment-specific issue, but the behavior strongly suggests a connection leak or missing connection cleanup during failed QR/reconnect/session initialization flows.
Also, I noticed that one status endpoint appeared stale while another status endpoint reflected the live state correctly. If needed, I can open a separate issue specifically for the status inconsistency, since it may be unrelated to the PostgreSQL connection accumulation problem.
- 主要语言
- Go
- 星标
- 971
- 派生
- 519
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
evolution-foundation/evolution-go 的其他 Issue
-
/user/info and /user/avatar hang for 75s when number is a phone number可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
-
POST /group/participant always returns 400 "participants is required and cannot be empty" (wrong validation middleware on route)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug
难度 1/5 1 小时以内 新手友好度 88/100
evolution-foundation/evolution-go#97 · 2 条评论 ·
查看 evolution-foundation/evolution-go 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
cmd/ebitenmobile: multi-language bindings run the complete generator twice可能已有人在做 @kumagi 今天认领。 未关闭os:macos performance
难度 2/5 1-3 小时 新手友好度 82/100
hajimehoshi/ebiten#4011 · 1 条评论 ·
维护者通常 1 天内回复
-
agent-butler-finding chore
难度 1/5 1 小时以内 新手友好度 78/100
jordansmall/spindrift#6318 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
Eyevinn/moqlivemock#166 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
JakeChampion/lang#14091 ·
维护者通常 1 天内回复