Skip to content

A daemon keeps the writer lock of a project it opened for one projectPath query #2087

Description

@bompus

When a session's daemon answers a query with an explicit projectPath for another indexed project, it opens that project in-process and takes its writer lock (.codegraph/writer.pid, fallback mode). The project cache has no idle release, so the lock stays held for as long as that daemon runs. The project's own daemon then can't take the writer role, and codegraph index on it is blocked, until the first daemon exits. Reconnecting MCP servers doesn't help, because the daemon is detached.

Repro: two indexed projects A and B. Start an MCP session in A, call codegraph_explore with projectPath: <B>, then look at B/.codegraph/writer.pid: it names A's daemon and stays that way.

Fix: release a secondary project after an idle timeout (10 min by default, configurable), which frees its writer lock. Happy to open a PR with tests.

Activity

  1. vinhch commented on Oct 1, 2026

    @vinhch

    One more effect on Windows: while the daemon holds the secondary project open (SQLite handle plus the recursive watcher), the project folder can't be renamed or deleted ("Access to the path is denied"). The idle release in #2093 would bound that to the timeout.

    Until it ships, we avoid projectPath for other repos and query them with codegraph explore -p instead, since the CLI exits after each query.

  2. ijbranch commented on Oct 2, 2026

    @ijbranch

    Short data point: we see the same thing as #2087, plus its mirror image - daemon A holding a lease
    socket to daemon B counts as a live client of B, so if A and B reference each other neither ever idles
    out (src/mcp/project-lifecycle.ts ~111-153, daemon.ts ~505-509). In our fork, leases are released
    after 10 idle minutes (env-tunable) and lease connections, marked in the hello, no longer count as live
    clients for the inactivity backstop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions