From 4ec8ec06e67aa752b65807fd4c7cd30eea98751d Mon Sep 17 00:00:00 2001 From: pingqiu Date: Tue, 1 Dec 2026 22:45:32 -0800 Subject: [PATCH 1/2] ci: stop a self-hosted job whose work or temp dir is not on NVMe One runner box kept its runners' work, temp and Go cache directories on its SATA system disk (the default install puts _work under the runner directory in /home). Under the process-level tests' fsync load that disk saturated and jobs timed out, which read as test failures. The first step of the test and known-bugs jobs on a self-hosted runner now checks that every disk behind the workspace, RUNNER_TEMP, TMPDIR and GOCACHE is NVMe (tmpfs accepted) and fails naming the runner and the directory otherwise. GitHub-hosted runners skip the step. The script's test stubs df and lsblk: NVMe, tmpfs, a not-yet-created dir pass; SATA, an array with a SATA member and a network share fail. Co-Authored-By: Claude Opus 5.5 --- .../.github/scripts/require-nvme-test.sh | 41 +++++++++++++++++++ seaweed-block/.github/scripts/require-nvme.sh | 32 +++++++++++++++ .../.github/workflows/known-bugs.yml | 9 ++++ seaweed-block/.github/workflows/test.yml | 9 ++++ 4 files changed, 91 insertions(+) create mode 100755 seaweed-block/.github/scripts/require-nvme-test.sh create mode 100755 seaweed-block/.github/scripts/require-nvme.sh diff --git a/seaweed-block/.github/scripts/require-nvme-test.sh b/seaweed-block/.github/scripts/require-nvme-test.sh new file mode 100755 index 0000000000..de476cf7e1 --- /dev/null +++ b/seaweed-block/.github/scripts/require-nvme-test.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# Tests require-nvme.sh with df and lsblk replaced by stubs on PATH. +set -euo pipefail +here=$(cd "$(dirname "$0")" && pwd) +t=$(mktemp -d) +trap 'rm -rf "$t"' EXIT +mkdir -p "$t/bin" "$t/nvme" "$t/sata" "$t/mem" "$t/raid" "$t/share" +# df --output=source DIR: the stub answers by the directory's name. +cat >"$t/bin/df" <"$t/bin/lsblk" <<'STUB' +#!/usr/bin/env bash +case "$3" in +/dev/nvme0n1p1) printf 'part \ndisk nvme\n' ;; +/dev/sda2) printf 'part \ndisk sata\n' ;; +/dev/md0) printf 'raid1 \npart \ndisk nvme\npart \ndisk sata\n' ;; +*) echo "lsblk: $3: not a block device" >&2; exit 32 ;; +esac +STUB +chmod +x "$t/bin/df" "$t/bin/lsblk" +run() { PATH="$t/bin:$PATH" RUNNER_NAME=r1 bash "$here/require-nvme.sh" "$@" >"$t/out" 2>&1; } +fail() { echo "FAIL: $*"; cat "$t/out"; exit 1; } + +run "$t/nvme" "$t/mem" "" || fail "nvme + tmpfs + empty arg must pass" +run "$t/nvme/not/made/yet" || fail "a missing dir is judged by its nearest existing parent" +! run "$t/nvme" "$t/sata" || fail "a SATA dir must fail" +grep -q "runner r1" "$t/out" || fail "the failure must name the runner" +grep -q "FAIL $t/sata" "$t/out" || fail "the failure must name the directory" +! run "$t/raid" || fail "an array with a SATA member must fail" +! run "$t/share" || fail "a network share must fail" +grep -q "not a block device" "$t/out" || fail "a network share must say why" +echo "require-nvme tests: ok" diff --git a/seaweed-block/.github/scripts/require-nvme.sh b/seaweed-block/.github/scripts/require-nvme.sh new file mode 100755 index 0000000000..d32f533dc6 --- /dev/null +++ b/seaweed-block/.github/scripts/require-nvme.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Fails a self-hosted job whose workspace, temp or Go cache directory is not +# on an NVMe disk. The process-level tests write and fsync real files; on a +# box whose system disk is SATA, a default runner install puts _work there and +# the tests time out under the disk load instead of failing on a real bug. +# A tmpfs directory is accepted (memory, not a slow disk). +# Usage: require-nvme.sh DIR... +set -euo pipefail +bad=0 +for p in "$@"; do + [ -n "$p" ] || continue + d=$p + while [ ! -e "$d" ]; do d=$(dirname "$d"); done + src=$(df --output=source "$d" | tail -n 1) + if [ "$src" = tmpfs ]; then + echo "ok $p: tmpfs" + continue + fi + # Every disk under the source (all members of an array) must be NVMe. + disks=$({ lsblk -nrso TYPE,TRAN "$src" 2>/dev/null || true; } | + awk '$1 == "disk" { print ($2 == "" ? "unknown" : $2) }' | sort -u | tr '\n' ' ') + if [ "$disks" = "nvme " ]; then + echo "ok $p: $src (nvme)" + else + echo "FAIL $p: $src (disk: ${disks:-not a block device})" + bad=1 + fi +done +if [ "$bad" -ne 0 ]; then + echo "runner ${RUNNER_NAME:-?}: work, temp and Go cache directories must be on NVMe; move them before this runner takes jobs" >&2 + exit 1 +fi diff --git a/seaweed-block/.github/workflows/known-bugs.yml b/seaweed-block/.github/workflows/known-bugs.yml index e12e56e46b..0d3e03c6ec 100644 --- a/seaweed-block/.github/workflows/known-bugs.yml +++ b/seaweed-block/.github/workflows/known-bugs.yml @@ -27,6 +27,15 @@ jobs: with: persist-credentials: false + - name: Runner disk is NVMe + # A self-hosted runner whose work, temp or Go cache directory sits on a + # SATA system disk times the process-level tests out under disk load; + # this names the runner and stops the job before it starts. + if: runner.environment == 'self-hosted' + run: | + bash .github/scripts/require-nvme-test.sh + bash .github/scripts/require-nvme.sh "$GITHUB_WORKSPACE" "$RUNNER_TEMP" "${TMPDIR:-/tmp}" "${GOCACHE:-$HOME/.cache/go-build}" + - name: Set up Go uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 with: diff --git a/seaweed-block/.github/workflows/test.yml b/seaweed-block/.github/workflows/test.yml index 6da3c87084..9b4e08d495 100644 --- a/seaweed-block/.github/workflows/test.yml +++ b/seaweed-block/.github/workflows/test.yml @@ -55,6 +55,15 @@ jobs: # step can see which packages the PR touches. fetch-depth: 2 + - name: Runner disk is NVMe + # A self-hosted runner whose work, temp or Go cache directory sits on a + # SATA system disk times the process-level tests out under disk load; + # this names the runner and stops the job before it starts. + if: runner.environment == 'self-hosted' + run: | + bash .github/scripts/require-nvme-test.sh + bash .github/scripts/require-nvme.sh "$GITHUB_WORKSPACE" "$RUNNER_TEMP" "${TMPDIR:-/tmp}" "${GOCACHE:-$HOME/.cache/go-build}" + - name: Docs-only pull request id: scope if: matrix.suite == 'process' && github.event_name == 'pull_request' From a2419b2cec5654c19cbc04bd65a1e4d6b5fc3553 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Tue, 1 Dec 2026 22:53:34 -0800 Subject: [PATCH 2/2] ci: judge tmpfs by filesystem type; an lsblk error voids its output A tmpfs mounted under another source name (shm, a custom label) was refused because the check compared the source name. And an lsblk that printed an NVMe disk and then failed was accepted, since its status was discarded. The check now reads the filesystem type from df and treats any lsblk failure as "not a block device". Two stub cases pin both. Co-Authored-By: Claude Opus 5.5 --- .../.github/scripts/require-nvme-test.sh | 20 +++++++++++-------- seaweed-block/.github/scripts/require-nvme.sh | 16 +++++++++------ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/seaweed-block/.github/scripts/require-nvme-test.sh b/seaweed-block/.github/scripts/require-nvme-test.sh index de476cf7e1..6c239536ea 100755 --- a/seaweed-block/.github/scripts/require-nvme-test.sh +++ b/seaweed-block/.github/scripts/require-nvme-test.sh @@ -4,16 +4,18 @@ set -euo pipefail here=$(cd "$(dirname "$0")" && pwd) t=$(mktemp -d) trap 'rm -rf "$t"' EXIT -mkdir -p "$t/bin" "$t/nvme" "$t/sata" "$t/mem" "$t/raid" "$t/share" -# df --output=source DIR: the stub answers by the directory's name. +mkdir -p "$t/bin" "$t/nvme" "$t/sata" "$t/mem" "$t/raid" "$t/share" "$t/half" +# df --output=source,fstype DIR: the stub answers by the directory's name. cat >"$t/bin/df" <&2; exit 32 ;; *) echo "lsblk: $3: not a block device" >&2; exit 32 ;; esac STUB @@ -30,7 +33,7 @@ chmod +x "$t/bin/df" "$t/bin/lsblk" run() { PATH="$t/bin:$PATH" RUNNER_NAME=r1 bash "$here/require-nvme.sh" "$@" >"$t/out" 2>&1; } fail() { echo "FAIL: $*"; cat "$t/out"; exit 1; } -run "$t/nvme" "$t/mem" "" || fail "nvme + tmpfs + empty arg must pass" +run "$t/nvme" "$t/mem" "" || fail "nvme + tmpfs (any source name) + empty arg must pass" run "$t/nvme/not/made/yet" || fail "a missing dir is judged by its nearest existing parent" ! run "$t/nvme" "$t/sata" || fail "a SATA dir must fail" grep -q "runner r1" "$t/out" || fail "the failure must name the runner" @@ -38,4 +41,5 @@ grep -q "FAIL $t/sata" "$t/out" || fail "the failure must name the directory" ! run "$t/raid" || fail "an array with a SATA member must fail" ! run "$t/share" || fail "a network share must fail" grep -q "not a block device" "$t/out" || fail "a network share must say why" +! run "$t/half" || fail "an lsblk error after partial NVMe output must fail" echo "require-nvme tests: ok" diff --git a/seaweed-block/.github/scripts/require-nvme.sh b/seaweed-block/.github/scripts/require-nvme.sh index d32f533dc6..5f4cab7a8d 100755 --- a/seaweed-block/.github/scripts/require-nvme.sh +++ b/seaweed-block/.github/scripts/require-nvme.sh @@ -11,14 +11,18 @@ for p in "$@"; do [ -n "$p" ] || continue d=$p while [ ! -e "$d" ]; do d=$(dirname "$d"); done - src=$(df --output=source "$d" | tail -n 1) - if [ "$src" = tmpfs ]; then - echo "ok $p: tmpfs" + read -r src fstype < <(df --output=source,fstype "$d" | tail -n 1) + if [ "$fstype" = tmpfs ]; then + echo "ok $p: $src (tmpfs)" continue fi - # Every disk under the source (all members of an array) must be NVMe. - disks=$({ lsblk -nrso TYPE,TRAN "$src" 2>/dev/null || true; } | - awk '$1 == "disk" { print ($2 == "" ? "unknown" : $2) }' | sort -u | tr '\n' ' ') + # Every disk under the source (all members of an array) must be NVMe; an + # lsblk error voids whatever it printed. + disks= + if tree=$(lsblk -nrso TYPE,TRAN "$src" 2>/dev/null); then + disks=$(printf '%s\n' "$tree" | + awk '$1 == "disk" { print ($2 == "" ? "unknown" : $2) }' | sort -u | tr '\n' ' ') + fi if [ "$disks" = "nvme " ]; then echo "ok $p: $src (nvme)" else