Skip to content

fix: remove 2-min exec timeout that orphans mine processes - #4

Open
atsyongki wants to merge 1 commit into
geco:mainfrom
atsyongki:fix/remove-mine-timeout
Open

fix: remove 2-min exec timeout that orphans mine processes#4
atsyongki wants to merge 1 commit into
geco:mainfrom
atsyongki:fix/remove-mine-timeout

Conversation

@atsyongki

Copy link
Copy Markdown

Problem

The exec() call that runs mempalace mine has timeout: 120000. On a large palace (tens of thousands of drawers), a mine legitimately takes longer than 2 minutes. When the timeout fires:

  1. Node kills only the wrapper shell — the mempalace mine python process is orphaned and keeps running, still holding the palace lock.
  2. The error callback fires immediately, setting miningLock = false.
  3. The next user message spawns another mine → orphan pileup, multiple mines contending for the palace lock.
  4. Repair/other palace writes can't acquire the lock, and interrupted mines can leave the HNSW index diverged from SQLite (vector search disabled).

Fix

Remove the arbitrary timeout. miningLock already serializes concurrent mines; the timeout only made things worse by orphaning processes and breaking that serialization. Long mines now run to completion; the exported session files are cleaned up in the success path as before.

Verification

  • Reproduced the issue: with the timeout in place, mines ran 10-21 min while the plugin killed the shell at 2 min, orphaning processes (visible as PPID 1).
  • After removing the timeout: mines complete normally, no orphans, no duplicate mines.

The exec() timeout of 120s killed only the wrapper shell when
'mempalace mine' exceeded 2 minutes on a large palace, orphaning
the python mine process which kept running and holding the palace
lock. miningLock was released early via the error callback, letting
duplicate concurrent mines pile up and contend for the lock, which
also blocked repair commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant