teknium1
939a2f64b4
fix: long-lived processes stop minting duplicate state.db writer handles
...
Gateway, dashboard, ACP server and the CLI already hold one registry-shared
SessionDB per state.db path, yet several in-process call paths still opened
a bare SessionDB() beside it. Each one is a full writer: schema init, write
lock, token-writer thread and a close-time WAL checkpoint. On a dashboard
serving overlapping requests that stacked up to the "5 live SessionDB
handles" precursor within seconds; per #110544 they are now harmless to each
other's WAL generation, but the leak itself remained.
Pure readers attach read_only=True (no writer connection, no write lock):
- plugins/hermes-achievements/dashboard/plugin_api.py::scan_sessions
(dashboard, per background scan and per /rescan; highest-frequency site)
- hermes_cli/console_engine.py::_session_db (dashboard console; list,
stats and export are reads; rename/optimize opt in to a writer)
- tools/process_registry_results.py::_owns_result (gateway, per retained
result load)
- hermes_cli/main.py::_session_db (last-session / title / cwd lookups)
- hermes_cli/terminal_breadcrumbs.py, hermes_cli/status.py,
hermes_cli/main_tui_launch.py (lookup one-shots)
Writers share the process's registry handle (hermes_state_registry.acquire;
close()/release_or_close release one refcount):
- acp_adapter/session.py::SessionManager._get_db — the AIAgent it builds
acquires the same path, so the ACP server held two writers per process
- hermes_cli/kanban_db_dispatch.py::_retag_legacy_worker_sessions
(gateway dispatcher tick)
- hermes_cli/main.py::_create_titled_session, hermes_cli/oneshot.py,
hermes_cli/foreign_sessions.py — the CLI acquires the same handle a
moment later
The "N live SessionDB handles" warning now counts only writable members:
read-only attaches are the sanctioned per-request shape for dashboard
routers and CLI lookups, and counting them turned a healthy topology into
an operator alarm (#100896 field reports of restart loops keyed on it).
Live repro (one registry writer + 4 overlapping dashboard/gateway paths in
one process): before 5 writable opens, 5 live handles, warning fired;
after 1 writable open (the registry handle), 0 from the request paths,
no warning.
Refs #100896 #103339
2026-09-14 08:10:36 -07:00
..
2026-09-14 07:21:18 -07:00
2026-09-13 05:09:43 -07:00
2026-09-11 15:45:43 +05:30
2026-09-02 22:36:16 -07:00
2026-09-07 12:50:29 -07:00
2026-09-02 22:36:16 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 13:49:57 -07:00
2026-09-12 21:12:18 -07:00
2026-09-11 19:39:12 -07:00
2026-09-14 06:02:05 -07:00
2026-09-03 13:49:57 -07:00
2026-09-03 13:49:57 -07:00
2026-09-03 13:49:57 -07:00
2026-09-14 06:02:05 -07:00
2026-09-03 09:44:26 -07:00
2026-09-13 05:08:29 -07:00
2026-09-02 22:36:16 -07:00
2026-09-02 22:36:16 -07:00
2026-09-02 22:36:15 -07:00
2026-09-03 09:44:26 -07:00
2026-09-13 05:07:11 -07:00
2026-09-13 05:09:06 -07:00
2026-09-13 05:09:06 -07:00
2026-09-13 05:07:11 -07:00
2026-09-03 17:13:22 -07:00
2026-09-12 01:35:05 -07:00
2026-09-10 10:35:07 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 13:49:57 -07:00
2026-09-03 14:16:54 -07:00
2026-09-02 22:47:50 -07:00
2026-09-02 22:47:50 -07:00
2026-09-10 10:35:07 -07:00
2026-09-03 14:16:54 -07:00
2026-09-11 19:39:12 -07:00
2026-09-03 14:16:54 -07:00
2026-09-13 12:35:36 -07:00
2026-09-12 08:43:28 -07:00
2026-09-03 14:16:54 -07:00
2026-09-03 14:16:54 -07:00
2026-09-06 23:31:05 +05:30
2026-09-03 14:16:54 -07:00
2026-09-10 10:35:07 -07:00
2026-09-03 14:16:54 -07:00
2026-09-11 15:44:00 -07:00
2026-09-13 14:41:26 -07:00
2026-09-13 12:35:36 -07:00
2026-09-13 05:09:43 -07:00
2026-09-11 15:44:00 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 09:44:26 -07:00
2026-09-04 00:15:16 -07:00
2026-09-02 22:36:16 -07:00
2026-09-11 15:44:00 -07:00
2026-09-02 23:08:22 -07:00
2026-09-13 05:09:43 -07:00
2026-09-05 18:46:53 +05:30
2026-09-10 10:35:07 -07:00
2026-09-02 22:36:16 -07:00
2026-09-10 02:21:16 +05:30
2026-09-10 02:21:16 +05:30
2026-09-11 19:39:12 -07:00
2026-09-07 08:18:56 -07:00
2026-09-03 09:44:26 -07:00
2026-09-13 21:30:02 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 00:10:18 -07:00
2026-09-13 21:31:57 -07:00
2026-09-08 02:26:05 +05:30
2026-09-13 21:31:57 -07:00
2026-09-11 19:39:12 -07:00
2026-09-10 10:23:12 -07:00
2026-09-06 12:02:43 -07:00
2026-09-13 21:05:42 -07:00
2026-09-11 11:54:49 -07:00
2026-09-13 21:05:42 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 00:10:18 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 17:13:22 -07:00
2026-09-11 15:29:15 -07:00
2026-09-03 17:13:22 -07:00
2026-09-09 11:46:36 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 17:13:22 -07:00
2026-09-02 22:48:08 -07:00
2026-09-03 03:31:03 -07:00
2026-09-03 13:33:47 -07:00
2026-09-07 00:28:46 +05:30
2026-09-12 20:52:49 -07:00
2026-09-03 13:28:22 -07:00
2026-09-03 13:10:52 -07:00
2026-09-03 13:30:27 -07:00
2026-09-11 15:29:15 -07:00
2026-09-11 15:44:00 -07:00
2026-09-03 17:13:22 -07:00
2026-09-12 21:55:07 -07:00
2026-09-03 13:53:03 -07:00
2026-09-02 22:50:57 -07:00
2026-09-13 21:03:11 -07:00
2026-09-13 21:03:11 -07:00
2026-09-11 19:39:12 -07:00
2026-09-02 22:06:11 -07:00
2026-09-05 13:51:06 -07:00
2026-09-13 14:37:17 -07:00
2026-09-13 14:37:17 -07:00
2026-09-12 12:32:55 -07:00
2026-09-13 19:19:36 -07:00
2026-09-10 02:21:16 +05:30
2026-09-12 10:00:06 +05:30
2026-09-03 00:11:01 -07:00
2026-09-07 08:22:35 -07:00
2026-09-13 20:43:33 -07:00
2026-09-13 20:43:33 -07:00
2026-09-13 20:43:33 -07:00
2026-09-03 17:13:22 -07:00
2026-09-10 02:21:16 +05:30
2026-09-02 23:56:55 -07:00
2026-09-11 19:39:12 -07:00
2026-09-13 05:09:43 -07:00
2026-09-13 15:41:01 -07:00
2026-09-13 20:45:25 -07:00
2026-09-13 15:41:01 -07:00
2026-09-11 15:27:23 -07:00
2026-09-13 06:29:12 -07:00
2026-09-12 01:35:05 -07:00
2026-09-13 15:41:01 -07:00
2026-09-07 22:47:33 +05:30
2026-09-13 20:44:29 -07:00
2026-09-11 15:27:23 -07:00
2026-09-13 06:29:12 -07:00
2026-09-13 20:45:25 -07:00
2026-09-13 15:41:01 -07:00
2026-09-12 20:43:42 -07:00
2026-09-09 12:19:13 +05:30
2026-09-03 01:43:42 -07:00
2026-09-04 00:15:16 -07:00
2026-09-02 22:59:19 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 17:13:22 -07:00
2026-09-13 20:46:22 -07:00
2026-09-12 21:13:40 -07:00
2026-09-04 00:15:16 -07:00
2026-09-13 14:43:04 -07:00
2026-09-03 17:13:22 -07:00
2026-09-11 19:58:07 -07:00
2026-09-13 14:35:32 -07:00
2026-09-14 08:10:36 -07:00
2026-09-13 21:04:45 -07:00
2026-09-03 09:44:26 -07:00
2026-09-12 22:09:19 -07:00
2026-09-04 00:15:16 -07:00
2026-09-11 15:26:46 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 17:13:22 -07:00
2026-09-04 00:15:16 -07:00
2026-09-13 12:35:36 -07:00
2026-09-07 08:14:51 -07:00
2026-09-03 13:49:57 -07:00
2026-09-11 11:54:49 -07:00
2026-09-03 01:36:04 -07:00
2026-09-11 15:26:46 -07:00
2026-09-11 06:24:11 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 01:41:16 -07:00
2026-09-03 17:13:22 -07:00
2026-09-04 08:15:22 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 13:33:47 -07:00
2026-09-12 01:35:05 -07:00
2026-09-09 12:19:13 +05:30
2026-09-11 11:54:49 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 00:55:09 -07:00
2026-09-12 05:09:26 -07:00
2026-09-13 05:09:43 -07:00
2026-09-13 05:09:43 -07:00
2026-09-07 05:59:43 -07:00
2026-09-11 11:54:49 -07:00
2026-09-11 11:54:49 -07:00
2026-09-03 13:22:48 -07:00
2026-09-02 21:42:18 -07:00
2026-09-02 21:42:18 -07:00
2026-09-12 21:50:30 -07:00
2026-09-06 07:17:03 -07:00
2026-09-03 00:05:14 -07:00
2026-09-11 11:54:49 -07:00
2026-09-04 00:15:16 -07:00
2026-09-06 07:17:03 -07:00
2026-09-06 07:17:03 -07:00
2026-09-03 01:09:55 -07:00
2026-09-03 13:27:01 -07:00
2026-09-03 01:09:55 -07:00
2026-09-13 05:07:50 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 01:09:12 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 22:37:39 -07:00
2026-09-13 14:31:21 -07:00
2026-09-06 13:32:51 +05:30
2026-09-07 12:50:29 -07:00
2026-09-05 19:01:22 +05:30
2026-09-07 06:05:51 -07:00
2026-09-03 13:24:04 -07:00
2026-09-13 05:09:43 -07:00
2026-09-11 11:19:53 +05:30
2026-09-11 15:29:15 -07:00
2026-09-10 11:48:01 -07:00
2026-09-07 08:09:20 -07:00
2026-09-03 01:13:51 -07:00
2026-09-12 01:35:05 -07:00
2026-09-03 09:44:26 -07:00
2026-09-11 15:26:46 -07:00
2026-09-11 15:44:00 -07:00
2026-09-13 05:09:43 -07:00
2026-09-11 19:39:12 -07:00
2026-09-13 21:04:08 -07:00
2026-09-10 02:21:16 +05:30
2026-09-10 02:21:16 +05:30
2026-09-12 10:00:08 +05:30
2026-09-03 13:17:25 -07:00
2026-09-13 05:07:50 -07:00
2026-09-13 05:09:43 -07:00
2026-09-03 13:30:31 -07:00
2026-09-03 13:17:25 -07:00
2026-09-13 05:07:50 -07:00
2026-09-03 13:20:22 -07:00
2026-09-13 05:07:50 -07:00
2026-09-03 09:44:26 -07:00
2026-09-13 05:32:38 -07:00
2026-09-03 13:20:22 -07:00
2026-09-03 01:17:43 -07:00
2026-09-03 13:20:22 -07:00
2026-09-03 09:44:26 -07:00
2026-09-13 05:07:50 -07:00
2026-09-03 13:20:22 -07:00
2026-09-13 05:07:50 -07:00
2026-09-03 17:13:22 -07:00
2026-09-13 12:35:36 -07:00
2026-09-13 09:18:54 -07:00
2026-09-13 14:46:38 -07:00
2026-09-13 05:07:50 -07:00
2026-09-11 19:14:24 -07:00
2026-09-03 13:30:31 -07:00
2026-09-13 14:39:29 -07:00
2026-09-03 13:24:36 -07:00
2026-09-03 13:24:36 -07:00
2026-09-13 05:07:11 -07:00
2026-09-12 21:30:38 -07:00
2026-09-03 13:08:53 -07:00
2026-09-05 18:46:16 +05:30
2026-09-04 07:17:00 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 00:10:38 -07:00
2026-09-13 05:07:11 -07:00
2026-09-13 12:35:36 -07:00
2026-09-13 05:07:50 -07:00
2026-09-03 00:27:38 -07:00
2026-09-03 17:13:22 -07:00