Skip to content

Prevent puter.fs.write from failing on concurrent writes#2287

Merged
KernelDeimos merged 3 commits intomainfrom
eric/261F0-1603
Jan 15, 2026
Merged

Prevent puter.fs.write from failing on concurrent writes#2287
KernelDeimos merged 3 commits intomainfrom
eric/261F0-1603

Conversation

@KernelDeimos
Copy link
Copy Markdown
Contributor

@KernelDeimos KernelDeimos commented Jan 15, 2026

These changes make parallel write operations with createMissingParents more robust.

Testing checklist for this PR:

  • test with puter-fs-write-parallel to verify the bug is fixed
  • run await puter.fs.mkdir('/user/some_dir') to verify basic directory creation still works
  • manually create a new directory in GUI to verify basic directory creation still works
  • run await puter.fs.mkdir('/user/a/b/c') when /user/a does not exist to verify createMissingParents is still required
  • run await puter.fs.mkdir('/admin/a/b/c', { createMissingParents: true }) to verify recursive directory creation still works

Handle a race condition affecting mkdir operations with the
`createMissingParents` option enabled. When creating a directory because
this option was specified, errors because the directory already exists
are likely due to a race condition and should not be propagated to the
client but instead handled by using the directory that's already there.
Extract common behavior from MkTree and QuickMkdir to a separate method
which is user by both operations.
Fix the status code handling in hl_mkdir and handling to the HLMkdir
operation itself. This effectively fixes #1603.

Resolves #1603
@KernelDeimos KernelDeimos merged commit 21d02e7 into main Jan 15, 2026
4 checks passed
@jelveh jelveh deleted the eric/261F0-1603 branch May 1, 2026 20:06
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