Files
hermes-agent/persistence/sqlite/_state
Mikhael Zimmermann c0e860e84d fix(state): remember a missing resource module instead of re-importing it per read
`_fd_soft_limit()` runs on every read-connection checkout and starts with
`import resource`. Python caches a successful import in sys.modules but not a
failed one, and `resource` does not exist on Windows, so every SQLite read
re-walked sys.path under the global import lock, from every reader thread at
once. On a multiplexed gateway that includes one hosted-room supervisor per
profile polling its store, which adds steady import-lock contention to the
event-loop starvation described in #143256 (Windows reproductions in #143256
and #153063).

Remember the failed import in a module flag. Behaviour is unchanged: the
function still returns None (unmeasurable, fail open) where `resource` is
missing, and still reads the live limit on every call where it exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 03:43:28 -08:00
..
…
…
…
…
…
…
…