hermes - 💡(How to fix) Fix [mcp_lazy] MEDIUM: get_pool has unlocked check-then-set race on pool creation

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fix

Guard create-and-insert under a module lock with double-checked locking (re-get inside the lock). Add a regression test for concurrent pool creation (existing test_concurrent_promotion.py tests promote, not creation).

RAW_BUFFERClick to expand / collapse

Severity: MEDIUM (concurrency, race)

get_pool has an unlocked check-then-set race on pool creation.

Evidence

plugins/mcp_lazy/pool.py:147-150get_pool does check-then-set on _pools (a WeakValueDictionary) with no lock around the get/create/assign. Two threads handling the same new session_id (e.g. agent thread + tool-dispatch thread) can each create a DeferredToolPool; one wins the dict, the loser's promotions are silently lost.

Impact

Under concurrent first-touch for one session, promoted-tool state can be silently lost — tools the model promoted stay stubbed.

Fix

Guard create-and-insert under a module lock with double-checked locking (re-get inside the lock). Add a regression test for concurrent pool creation (existing test_concurrent_promotion.py tests promote, not creation).

Note

If Hermes guarantees single-threaded per-session request handling, severity downgrades to LOW — worth confirming against the dispatch model.


Filed from opus-4.8 plugin audit (mcp_lazy).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING