Skip to content

fix (orchestrator): resolve EPERM errors on Windows during checkpoint#20

Merged
Dhravya merged 1 commit intosupermemoryai:mainfrom
ramblinghermit0403:fix/windows-eperm-checkpoint
Mar 23, 2026
Merged

fix (orchestrator): resolve EPERM errors on Windows during checkpoint#20
Dhravya merged 1 commit intosupermemoryai:mainfrom
ramblinghermit0403:fix/windows-eperm-checkpoint

Conversation

@ramblinghermit0403
Copy link
Contributor

Hey! I ran into some EPERM error: operation not permitted errors while running MemoryBench on Windows, specifically when the system tries to save the checkpoint file during a run (or when stopping the run, which triggers a final save). It looks like fs.renameSync sometimes conflicts with file locks (likely anti-virus or the OS just holding onto handles briefly).

I fixed this by:

Wrapping the atomic renameSync operation in a retry loop.
Adding exponential backoff to handle transient EBUSY or EPERM locks, which are common on Windows.
This preserves the safety of atomic writes (vital for crash resilience) while making it robust against Windows file locking issues.
On Linux/macOS, the rename succeeds on the first try, so there is no performance impact.

Copy link

@vorflux vorflux bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(aside) Looks good overall -- the retry-with-backoff approach is the standard fix for Windows EPERM/EBUSY on renameSync. Logic is correct, no performance impact on Linux/macOS, and the existing saveLock serialization is preserved. One minor nit below, otherwise this is mergeable.

@Dhravya Dhravya self-requested a review March 23, 2026 22:55
@Dhravya Dhravya merged commit f18dd56 into supermemoryai:main Mar 23, 2026
1 check passed
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.

2 participants