Skip to content

Bug: Kanban 数据库连接泄漏导致 Gateway 调度器崩溃 #28285

@X-bluewinds

Description

@X-bluewinds

描述

Gateway 的 kanban dispatcher tick 失败,导致所有定时任务(cron jobs)停止执行。

环境

  • Hermes 版本: 0.14.0 (2026.5.16) [43e566f]
  • OS: Linux WSL2 (Ubuntu)
  • Python: 3.14.4
  • 部署方式: systemd user service

错误日志

sqlite3.OperationalError: unable to open database file

后续伴随:

[Errno 24] Too many open files: '/home/xxx/.hermes/.channel_directory_xxx.tmp'

分析

  • 进程 PID 32460 打开了 1000+ 个 kanban.db 文件句柄(达到 ulimit -n = 1024 上限)
  • 这是典型的数据库连接泄漏
  • 代码有 finally: conn.close() 逻辑(run.py:4709-4714),但运行时仍然泄漏
  • 可能原因:多线程环境下异常传播导致 finally 块未正确执行,或 WAL 模式副作用

影响

  • 整个调度系统(定时任务、cronjob)全部卡死
  • kanban dispatcher tick 每分钟失败一次
  • Gateway 进程无法恢复,需要重启

调试报告

临时解决方案

重启 gateway 进程:pkill -f "hermes_cli.main gateway" 然后重新启动

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — major feature broken, no workaroundcomp/cronCron scheduler and job managementcomp/gatewayGateway runner, session dispatch, deliverytype/bugSomething isn't working

    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