Skip to content

Fix concurrent initialization directory creation - #267

Merged
VolkerChristian merged 1 commit into
masterfrom
fix-concurrent-runtime-directories
Oct 10, 2026
Merged

VolkerChristian merged 1 commit into
masterfrom
fix-concurrent-runtime-directories

Conversation

@VolkerChristian

Copy link
Copy Markdown
Member

Architectural invariant

Concurrent processes sharing the configuration, state and runtime directories must initialize successfully when another process creates a directory first. Only real filesystem errors are failures; ownership and permissions are changed only by the creator.

Fix

Remove the racy exists prechecks and the false-result error branches from Config::init. std::filesystem::create_directories is now the sole authority: true means newly created, false means an existing directory, and actual filesystem errors still propagate. This also rejects an existing non-directory instead of silently accepting it.

No retries, test serialization, precreated directories, workflow workarounds, new production helpers or public API/ABI changes.

Regression and verification

  • Eight boundary scenarios exercise fresh/existing directories, a competing creator for each of the three paths, and an obstructing file for each path.
  • Uses the existing test-only libc interposition pattern to force the exact losing mkdir result deterministically, without production hooks. Verifies existing and competing-creator permissions are preserved.
  • Before the fix: fresh/existing passed, all three forced races and all three file obstructions failed.
  • After the fix: 220/220 CTests passed, unprivileged, GCC 15.3.0 on Debian trixie, parallel 8, fresh HOME; includes installed-consumer verification.
  • clang-format 19, repository cmake-format configuration, and git diff --check passed.
  • Production changes: +3/-12 (net -9 lines). Test changes: +172/-0 (includes existing-style copyright headers and CMake registration).

This resolves the startup race observed in default-branch Verify run https://github.com/SNodeC/snode.c/actions/runs/38068740872 before the development SDK could be published. Package workflows, licence files, READMEs, VERSION and stable release tags are unchanged. CodexUI/AutoTalk test fixes remain explicitly deferred.

@VolkerChristian
VolkerChristian merged commit 795678c into master Oct 10, 2026
10 checks passed
VolkerChristian added a commit that referenced this pull request Oct 12, 2026
Fix concurrent initialization directory creation
@VolkerChristian
VolkerChristian deleted the fix-concurrent-runtime-directories branch October 15, 2026 19:13
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