Skip to content

foundationdb: fix test hang - #131

Merged
twitchyliquid64 merged 1 commit into
mainfrom
tom/embedded
Apr 28, 2026
Merged

foundationdb: fix test hang#131
twitchyliquid64 merged 1 commit into
mainfrom
tom/embedded

Conversation

@twitchyliquid64

@twitchyliquid64 twitchyliquid64 commented Apr 28, 2026

Copy link
Copy Markdown
Member

For unknown reasons the cluster fails to start on one of my machines when setup on a tmpfs. This adjusts it to run on cwd, which is always on the main fs, which should be backed by ext4.

Summary by CodeRabbit

  • Tests
    • Updated FoundationDB server smoke testing infrastructure to adjust how configuration and directory paths are managed during testing operations.

Note: This is an internal testing infrastructure change with no impact on end-user functionality.

@twitchyliquid64
twitchyliquid64 requested a review from msample April 28, 2026 01:47
@coderabbitai

coderabbitai Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The server_smoke test script in the FoundationDB build configuration is modified to write cluster configuration and data/log directories to the current working directory instead of a temporary directory, removing mktemp -d usage and redirecting paths accordingly.

Changes

Cohort / File(s) Summary
FoundationDB Test Script
packages/foundationdb/build.ncl
Modified server_smoke test to write FoundationDB cluster configuration and data/log directories to current working directory ($(pwd)) instead of temporary directory.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hops with glee through the directory

A rabbit's test now writes with grace,
No temp dirs lost in cyberspace,
To $(pwd) the configs stay,
FoundationDB finds its way! 🏗️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'foundationdb: fix test hang' directly describes the main objective of the pull request: fixing a test hang issue in the FoundationDB test setup by changing where cluster files are stored.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tom/embedded

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/foundationdb/build.ncl`:
- Around line 91-95: The current setup uses fixed paths derived from BASE=$(pwd)
(CLUSTER_FILE, DATA_DIR, LOG_DIR) which can cause cross-run collisions; change
BASE to a unique per-run directory (e.g. create a temp run dir using mktemp -d
or append a timestamp/UUID to $(pwd)) and update CLUSTER_FILE, DATA_DIR, LOG_DIR
to point inside that per-run BASE, then keep the mkdir -p for DATA_DIR and
LOG_DIR (and optionally add a cleanup/trap to remove the per-run dir). Ensure
you update references to BASE, CLUSTER_FILE, DATA_DIR, and LOG_DIR so all
components use the isolated run directory.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a7e7b38d-b3e1-48ea-8470-e077ff670cf1

📥 Commits

Reviewing files that changed from the base of the PR and between 1965994 and 2ca338e.

📒 Files selected for processing (1)
  • packages/foundationdb/build.ncl

Comment on lines +91 to 95
BASE=$(pwd)
CLUSTER_FILE="$BASE/fdb.cluster"
DATA_DIR="$BASE/data"
LOG_DIR="$BASE/logs"
mkdir -p "$DATA_DIR" "$LOG_DIR"

@coderabbitai coderabbitai Bot Apr 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Use a per-run subdirectory under pwd to prevent cross-run state collisions.

Using fixed paths ($PWD/data, $PWD/logs, $PWD/fdb.cluster) can leave stale state and cause flaky reruns or interference when tests share a workdir. You can keep the ext4 workaround and still isolate by creating a unique dir under cwd.

Suggested change
-            BASE=$(pwd)
+            BASE=$(mktemp -d -p "$(pwd)" fdb-smoke.XXXXXX)
+            trap 'if [ -n "${SERVER_PID:-}" ]; then kill "$SERVER_PID" 2>/dev/null || true; wait "$SERVER_PID" 2>/dev/null || true; fi; rm -rf "$BASE"' EXIT
             CLUSTER_FILE="$BASE/fdb.cluster"
             DATA_DIR="$BASE/data"
             LOG_DIR="$BASE/logs"
             mkdir -p "$DATA_DIR" "$LOG_DIR"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/foundationdb/build.ncl` around lines 91 - 95, The current setup uses
fixed paths derived from BASE=$(pwd) (CLUSTER_FILE, DATA_DIR, LOG_DIR) which can
cause cross-run collisions; change BASE to a unique per-run directory (e.g.
create a temp run dir using mktemp -d or append a timestamp/UUID to $(pwd)) and
update CLUSTER_FILE, DATA_DIR, LOG_DIR to point inside that per-run BASE, then
keep the mkdir -p for DATA_DIR and LOG_DIR (and optionally add a cleanup/trap to
remove the per-run dir). Ensure you update references to BASE, CLUSTER_FILE,
DATA_DIR, and LOG_DIR so all components use the isolated run directory.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

these tests are run in an ephemeral sandbox. Not an issue.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@msample, understood — thanks for the clarification! Since each test run gets its own ephemeral sandbox, fixed paths under $(pwd) are perfectly safe here and there's no risk of cross-run interference. I'll keep this in mind for future reviews.

(´。• ω •。`)


✏️ Learnings added
Learnt from: msample
Repo: gominimal/pkgs PR: 131
File: packages/foundationdb/build.ncl:91-95
Timestamp: 2026-04-28T01:52:37.341Z
Learning: In the gominimal/pkgs repository, tests (including those in packages/foundationdb/build.ncl) are run inside ephemeral sandboxes, so using fixed paths under $(pwd) for test state (cluster files, data dirs, log dirs) does not cause cross-run collisions. Isolation concerns about fixed working-directory paths in tests do not apply here.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: CR
Repo: gominimal/pkgs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-24T19:04:09.256Z
Learning: Create a new package by creating a 'packages/<name>' directory with at minimum: build.ncl with name, build_deps, cmd, and outputs; build.sh with build instructions

Learnt from: CR
Repo: gominimal/pkgs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-24T19:04:09.256Z
Learning: Applies to packages/**/build.ncl : Declare build scripts as a Local dependency in build_deps: '{ file = "build.sh" } | Local'

@msample msample left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@twitchyliquid64
twitchyliquid64 added this pull request to the merge queue Apr 28, 2026
Merged via the queue into main with commit f3afddf Apr 28, 2026
3 checks passed
@twitchyliquid64
twitchyliquid64 deleted the tom/embedded branch April 28, 2026 02:00
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