mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
Compare commits
19
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe313eac98 | ||
|
|
97d582db43 | ||
|
|
ab17f81235 | ||
|
|
577eb2ebad | ||
|
|
83102f60d4 | ||
|
|
c6306a12f7 | ||
|
|
20c36760b9 | ||
|
|
ff4bc9a0d7 | ||
|
|
af7f50945f | ||
|
|
14b6e653fa | ||
|
|
bd82342f08 | ||
|
|
6e445da214 | ||
|
|
77abb0ad39 | ||
|
|
cb0b5ed62b | ||
|
|
383c3b8184 | ||
|
|
679444bd1a | ||
|
|
3a72a78ba9 | ||
|
|
6dbba4cb24 | ||
|
|
e403ac4c9d |
No files matched your search
@@ -135,8 +135,9 @@ jobs:
|
||||
docker cp "$container:/usr/local/bin/$binary" "$out/bin/$binary"
|
||||
done
|
||||
bash seaweed-block/scripts/refuse-lab-binary.sh "$out/bin/"*
|
||||
cp seaweed-block/deploy/systemd/sw-block.tmpfiles.conf "$out/bin/sw-block.tmpfiles.conf"
|
||||
asset="sw-block-${version}-linux-amd64.tar.gz"
|
||||
tar -C "$out/bin" -czf "$out/$asset" blockmaster blockvolume sw-block
|
||||
tar -C "$out/bin" -czf "$out/$asset" blockmaster blockvolume sw-block sw-block.tmpfiles.conf
|
||||
(cd "$out" && sha256sum "$asset" >SHA256SUMS)
|
||||
prerelease=false
|
||||
if [[ "$version" == *-* ]]; then prerelease=true; fi
|
||||
|
||||
@@ -98,6 +98,10 @@ jobs:
|
||||
python3 -B ../.github/block/scripts/doc-links-check-test.py
|
||||
python3 -I ../.github/block/scripts/doc-links-check.py .
|
||||
|
||||
- name: Release binary archive contract
|
||||
if: matrix.suite == 'unit'
|
||||
run: python3 -I .github/scripts/release-binary-assets-test.py
|
||||
|
||||
- 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;
|
||||
|
||||
@@ -97,3 +97,11 @@ TestWeedClustersSideBySideKeepTheirOwnFilerCensus
|
||||
# Kubernetes state: a holder on a wiped state directory never comes up empty.
|
||||
TestRF1HolderOnAWipedStateDirectoryRefusesStoreLost
|
||||
TestRF3WipedPrimaryRefusesAndASurvivorServesItsData
|
||||
|
||||
# Non-root mini startup and owned cleanup controls.
|
||||
TestMiniStartsWithoutRootAndNamesItsBinaries
|
||||
TestMiniOwnedGroupCleanupStopsDescendants
|
||||
TestMiniSettledCleanupDoesNotSignal
|
||||
TestMiniCleanupFailStopAndSettlement
|
||||
TestMiniContextAllowsChildShutdownGrace
|
||||
TestMiniLockProofRequiresContention
|
||||
@@ -7,6 +7,41 @@ REV = "a" * 40
|
||||
DIGEST = "example.invalid/block@sha256:" + "b" * 64
|
||||
|
||||
class ReleaseAssets(unittest.TestCase):
|
||||
def test_active_root_release_contains_tmpfiles(self):
|
||||
repo = HERE.parents[2]
|
||||
workflow = (repo / '.github/workflows/block-release.yml').read_text()
|
||||
step = workflow.split(' - name: Publish matching binary tarball\n', 1)[1]
|
||||
script = step.split(' run: |\n', 1)[1].split('\n - name:', 1)[0]
|
||||
script = '\n'.join(line[10:] for line in script.splitlines())
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
tools = root / 'tools'; tools.mkdir()
|
||||
image = root / 'image'; image.mkdir()
|
||||
for name in ('blockmaster', 'blockvolume', 'sw-block'):
|
||||
(image / name).write_bytes(('#!/bin/sh\necho '+name+' release\n').encode())
|
||||
(image / name).chmod(0o755)
|
||||
(tools / 'docker').write_text('''#!/usr/bin/env python3
|
||||
import os,pathlib,shutil,sys
|
||||
a=sys.argv[1:]
|
||||
if a[0]=='create': print('owned-container')
|
||||
elif a[0]=='cp': shutil.copy2(pathlib.Path(os.environ['IMAGE'])/a[1].rsplit('/',1)[1],a[2])
|
||||
''')
|
||||
(tools / 'gh').write_text('#!/bin/sh\nexit 0\n')
|
||||
for tool in tools.iterdir(): tool.chmod(0o755)
|
||||
env = dict(os.environ, PATH=str(tools)+os.pathsep+os.environ['PATH'],
|
||||
IMAGE=str(image), RUNNER_TEMP=str(root), BLOCK_IMAGE='example/block',
|
||||
BLOCK_DIGEST='sha256:'+'b'*64, GITHUB_REF_NAME='seaweed-block/v1.1.2',
|
||||
GITHUB_REPOSITORY='example/block', NOTES=str(root/'notes'))
|
||||
result = subprocess.run(['bash', '-c', script], cwd=repo, env=env,
|
||||
capture_output=True, text=True, timeout=15)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
with tarfile.open(root/'block-release/sw-block-v1.1.2-linux-amd64.tar.gz') as tar:
|
||||
self.assertEqual(set(tar.getnames()), {'blockmaster', 'blockvolume', 'sw-block', 'sw-block.tmpfiles.conf'})
|
||||
self.assertEqual(tar.extractfile('sw-block.tmpfiles.conf').read(),
|
||||
(repo/'seaweed-block/deploy/systemd/sw-block.tmpfiles.conf').read_bytes())
|
||||
subprocess.run(['sha256sum', '--check', 'SHA256SUMS'], cwd=root/'block-release',
|
||||
check=True, capture_output=True)
|
||||
|
||||
def run_case(self, bad=None, mode="revision", existing=True, tag="v1.1.1",
|
||||
docker_rm_rc=0, rm_rc=0, publish_rc=0):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
@@ -23,6 +58,7 @@ class ReleaseAssets(unittest.TestCase):
|
||||
else: self.fail("invalid fixture mode")
|
||||
data=(f"#!/bin/sh\necho '{name} revision={revision} modified={modified}{suffix}'\nexit {status}\n").encode()
|
||||
(image/name).write_bytes(data); (image/name).chmod(0o755); expected[name]=data
|
||||
expected["sw-block.tmpfiles.conf"]=(HERE.parent.parent/"deploy"/"systemd"/"sw-block.tmpfiles.conf").read_bytes()
|
||||
log=root/"calls.jsonl"; state=root/"release.json"; state.write_text(json.dumps({"prerelease":"-" not in tag}))
|
||||
common="""#!/usr/bin/env python3
|
||||
import json,os,pathlib,shutil,sys
|
||||
|
||||
+3
-1
@@ -33,9 +33,11 @@ for binary in blockmaster blockvolume sw-block; do
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
# The tmpfiles.d entry that creates the host volume lock directory for the units.
|
||||
cp -- "$(dirname -- "$0")/../../deploy/systemd/sw-block.tmpfiles.conf" "$work/bin/sw-block.tmpfiles.conf"
|
||||
mkdir -p "$out"
|
||||
asset="sw-block-${tag}-linux-amd64.tar.gz"
|
||||
tar -C "$work/bin" -czf "$out/$asset" blockmaster blockvolume sw-block
|
||||
tar -C "$work/bin" -czf "$out/$asset" blockmaster blockvolume sw-block sw-block.tmpfiles.conf
|
||||
(cd "$out" && sha256sum "$asset" >SHA256SUMS)
|
||||
prerelease=false
|
||||
if [[ "$tag" == *-* ]]; then prerelease=true; fi
|
||||
|
||||
+10
-8
@@ -116,23 +116,25 @@ TAG=v1.1.1
|
||||
curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/$TAG/sw-block-$TAG-linux-amd64.tar.gz
|
||||
curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/$TAG/SHA256SUMS
|
||||
sha256sum -c --ignore-missing SHA256SUMS && tar -xzf sw-block-$TAG-linux-amd64.tar.gz
|
||||
export PATH="$PWD:$PATH" # so the sw-block commands that mini prints run as shown
|
||||
# v1.1.1 prerequisite: its child lookup uses PATH and its lock is host-wide.
|
||||
export PATH="$PWD:$PATH"
|
||||
sudo install -d -m 0755 /run/sw-block
|
||||
sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" /run/sw-block/locks
|
||||
./blockvolume --version # must print the tag's commit
|
||||
# blockvolume keeps one lock per volume here, so only one live process serves a volume on a host:
|
||||
sudo install -d -m 0755 -o root -g root /run/sw-block
|
||||
sudo install -d -m 0755 -o "$USER" -g "$(id -gn)" /run/sw-block/locks
|
||||
./sw-block mini --dir ./swb-mini --weed /path/to/weed
|
||||
```
|
||||
|
||||
A failed start leaves `--dir` behind: start again with a new `--dir`, or on the same one with `--reuse`.
|
||||
From v1.1.2 `mini` needs no `sudo` to start: it keeps the volume lock under `--dir`, prints every command with the
|
||||
absolute paths of `sw-block` and `weed`, and on a failed start prints the `--reuse` command that starts again on the
|
||||
same `--dir`. With v1.1.1, see its [known issue](docs/releases/v1.1.1.md#known-issue-sw-block-mini-as-a-non-root-user-fixed-in-v112).
|
||||
|
||||
**What it shows today:**
|
||||
- `mini` starts `weed mini`, `blockmaster` and one `blockvolume`: volume `v1`, 256 MiB, on loopback.
|
||||
- It never runs `sudo` itself. It prints the `nvme connect` command that attaches `v1`, and the status, check and
|
||||
snapshot commands. After the connect, `sudo nvme list` shows the disk's device (for example `/dev/nvme0n1`).
|
||||
- Snapshots of `v1` work at once, through the `sw-block ops chunk snapshot` command it prints. A scheduled
|
||||
`sched-<time>` snapshot also appears soon after the start. A restore into a new volume does not run inside `mini`
|
||||
yet; use the standalone setup for it.
|
||||
- Snapshots of `v1` work at once, through the `sw-block ops chunk snapshot` command it prints. From v1.1.2 `mini`
|
||||
takes no scheduled snapshot (with v1.1.1 a scheduled `sched-<time>` snapshot appears soon after the start). A
|
||||
restore into a new volume does not run inside `mini` yet; use the standalone setup for it.
|
||||
- To stop: unmount `v1`, run the `sudo nvme disconnect` that `mini` printed, then press Ctrl-C.
|
||||
|
||||
**Next:**
|
||||
|
||||
@@ -129,8 +129,8 @@ type flags struct {
|
||||
durableBlockSize uint
|
||||
durableWALMultiBlockRecords bool
|
||||
durableWALRecoveryTestDisableFlusher bool
|
||||
// volumeLockDirTestOnly replaces durable.HostVolumeLockDir (hidden,
|
||||
// test-only; refused under systemd).
|
||||
// volumeLockDirTestOnly replaces durable.HostVolumeLockDir (hidden, for
|
||||
// tests and sw-block mini's one-user trial; refused under systemd).
|
||||
volumeLockDirTestOnly string
|
||||
|
||||
// WAL retention window past checkpoint LSN. Zero = strict
|
||||
@@ -333,7 +333,7 @@ func parseFlagsWithCgroup(args []string, readFile func(string) ([]byte, error))
|
||||
return flags{}, err
|
||||
}
|
||||
if f.volumeLockDirTestOnly != "" && os.Getenv("INVOCATION_ID") != "" {
|
||||
return flags{}, fmt.Errorf("--%s is test-only and refused under systemd (INVOCATION_ID is set): the one-process-per-host guarantee needs %s", volumeLockDirTestOnlyFlag, durable.HostVolumeLockDir)
|
||||
return flags{}, fmt.Errorf("--%s is for tests and trial runs and refused under systemd (INVOCATION_ID is set): the one-process-per-host guarantee needs %s", volumeLockDirTestOnlyFlag, durable.HostVolumeLockDir)
|
||||
}
|
||||
if f.recoveryMode != "legacy" && f.recoveryMode != "dual-lane" {
|
||||
return flags{}, fmt.Errorf("--recovery-mode=%q invalid; want \"legacy\" or \"dual-lane\"", f.recoveryMode)
|
||||
@@ -757,7 +757,7 @@ func runVolume(f flags, exits *processExit) int {
|
||||
VolumeLockDirTestOnly: f.volumeLockDirTestOnly,
|
||||
}
|
||||
if f.volumeLockDirTestOnly != "" {
|
||||
fmt.Fprintf(os.Stderr, "blockvolume: volume lock directory %s is a test override: the one-process-per-host guarantee does not hold\n", f.volumeLockDirTestOnly)
|
||||
fmt.Fprintf(os.Stderr, "blockvolume: volume lock directory %s is an override: one process per volume is enforced only among processes using it\n", f.volumeLockDirTestOnly)
|
||||
}
|
||||
var chunkErr error
|
||||
var chunk chunkWiring
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
//go:build linux && subprocess && chunkstore_integration
|
||||
|
||||
package main_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// sw-block mini starts as any user on a host without /run/sw-block: the
|
||||
// holder takes its volume lock under --dir and serves, every sw-block and
|
||||
// weed command mini prints names the binary by its absolute path, and no
|
||||
// scheduled snapshot runs. A start that fails after --dir was made stops what
|
||||
// it started and prints the --reuse command for the same --dir.
|
||||
func TestMiniStartsWithoutRootAndNamesItsBinaries(t *testing.T) {
|
||||
assertMiniUnprivileged(t)
|
||||
weed := os.Getenv("CHUNKSTORE_WEED")
|
||||
if weed == "" {
|
||||
t.Fatal("CHUNKSTORE_WEED must name the pinned real SeaweedFS binary")
|
||||
}
|
||||
var err error
|
||||
weed, err = filepath.Abs(weed)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// The real startup/output assertion must exercise the production hint,
|
||||
// even when CI supplied an ordinary path. Both spaces and apostrophes need
|
||||
// POSIX quoting; exec still receives the path as one argument.
|
||||
quotedWeed := filepath.Join(t.TempDir(), "weed's tools")
|
||||
if err := os.Symlink(weed, quotedWeed); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
weed = quotedWeed
|
||||
bins := os.Getenv("SWBLOCK_TEST_BINS")
|
||||
if bins == "" {
|
||||
bins = t.TempDir()
|
||||
for _, b := range []string{"blockmaster", "blockvolume", "sw-block"} {
|
||||
miniGoBuild(t, filepath.Join(bins, b), "github.com/seaweedfs/seaweed-block/cmd/"+b)
|
||||
}
|
||||
}
|
||||
bins, err = filepath.Abs(bins)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cli := filepath.Join(bins, "sw-block")
|
||||
shift := miniPortShift(t)
|
||||
dir := filepath.Join(t.TempDir(), "mini")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 4*time.Minute)
|
||||
defer cancel()
|
||||
p := startOwnedMini(t, ctx, cli, "mini", "--dir", dir, "--bin", bins, "--weed", weed, "--port-shift", fmt.Sprint(shift))
|
||||
for !strings.Contains(p.output.String(), "sw-block mini: running") {
|
||||
select {
|
||||
case <-p.done:
|
||||
t.Fatalf("mini did not reach running: %v\n%s", p.err, p.output.String())
|
||||
case <-ctx.Done():
|
||||
t.Fatalf("mini startup expired: %s", p.output.String())
|
||||
case <-time.After(20 * time.Millisecond):
|
||||
}
|
||||
}
|
||||
// The running line precedes the hints; await the last hint without reading
|
||||
// a buffer concurrently with its writer.
|
||||
for !strings.Contains(p.output.String(), miniHintWord(weed)+" shell -master=") {
|
||||
select {
|
||||
case <-p.done:
|
||||
t.Fatalf("mini exited before its hints: %s", p.output.String())
|
||||
case <-ctx.Done():
|
||||
t.Fatalf("mini hints expired: %s", p.output.String())
|
||||
case <-time.After(20 * time.Millisecond):
|
||||
}
|
||||
}
|
||||
if err := miniLockConflict(filepath.Join(dir, "locks", "v1.lock")); err != nil {
|
||||
t.Fatalf("serving holder does not own its trial lock: %v", err)
|
||||
}
|
||||
if err := p.signalLeader(syscall.SIGINT); err != nil {
|
||||
t.Fatalf("could not deliver Ctrl-C: %v", err)
|
||||
}
|
||||
if err := p.join(t, 40*time.Second); err != nil {
|
||||
t.Fatalf("mini after Ctrl-C: %v\n%s", err, p.output.String())
|
||||
}
|
||||
p.assertStopped(t) // before the safety-net cleanup: product shutdown owns this
|
||||
t.Logf("sw-block mini output:\n%s", p.output.String())
|
||||
if !exists(filepath.Join(dir, "locks", "v1.lock")) {
|
||||
t.Fatalf("the holder's lock is not under --dir")
|
||||
}
|
||||
text := p.output.String()
|
||||
if strings.Contains(text, "+ sw-block ") || strings.Contains(text, " sw-block ") {
|
||||
t.Errorf("mini prints a sw-block command without its absolute path")
|
||||
}
|
||||
for _, want := range []string{" " + miniHintWord(cli) + " ops workspace show", " " + miniHintWord(cli) + " ops chunk snapshot", miniHintWord(weed) + " shell -master=", "mini takes no scheduled snapshot", miniHintWord(cli) + " mini --dir "} {
|
||||
if !strings.Contains(text, want) {
|
||||
t.Errorf("mini's output lacks %q", want)
|
||||
}
|
||||
}
|
||||
|
||||
// A start that fails after --dir exists names the --reuse command.
|
||||
broken := t.TempDir()
|
||||
for _, b := range []string{"blockmaster", "sw-block"} {
|
||||
if err := os.Symlink(filepath.Join(bins, b), filepath.Join(broken, b)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(broken, "blockvolume"), []byte("#!/bin/sh"+string(rune(10))+"echo refused >&2; exit 1"+string(rune(10))), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
dir2 := filepath.Join(t.TempDir(), "mini")
|
||||
ctx2, cancel2 := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||
defer cancel2()
|
||||
p2 := startOwnedMini(t, ctx2, cli, "mini", "--dir", dir2, "--bin", broken, "--weed", weed, "--port-shift", fmt.Sprint(miniPortShift(t)))
|
||||
err = p2.join(t, 3*time.Minute+miniShutdownGrace+10*time.Second)
|
||||
p2.assertNaturalExit(t)
|
||||
b2 := p2.output.String()
|
||||
t.Logf("failed start:\n%s", b2)
|
||||
if err == nil || !strings.Contains(b2, "start again on it with") || !strings.Contains(b2, miniHintWord(cli)+" mini --dir "+miniHintWord(dir2)+" --reuse") {
|
||||
t.Fatalf("a failed start: %v", err)
|
||||
}
|
||||
for _, binary := range []string{weed, filepath.Join(broken, "blockmaster"), filepath.Join(broken, "blockvolume")} {
|
||||
if !strings.Contains(b2, "+ "+binary+" ") {
|
||||
t.Fatalf("failed-start path did not reach %s: %s", binary, b2)
|
||||
}
|
||||
}
|
||||
p2.assertStopped(t) // rejects a failed start which left weed/master running
|
||||
|
||||
}
|
||||
|
||||
func miniGoBuild(t *testing.T, out, pkg string) {
|
||||
t.Helper()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||
defer cancel()
|
||||
p := startOwnedMini(t, ctx, "go", "build", "-o", out, pkg)
|
||||
if err := p.join(t, 3*time.Minute+miniShutdownGrace+10*time.Second); err != nil {
|
||||
t.Fatalf("build %s: %v\n%s", pkg, err, p.output.String())
|
||||
}
|
||||
p.assertStopped(t)
|
||||
|
||||
}
|
||||
|
||||
// miniPortShift picks a --port-shift whose every mini port (defaultMiniPorts
|
||||
// in cmd/sw-block) is claimed host-wide and free now, as the other harnesses'
|
||||
// ports are, so a parallel process-level shard never binds one of them.
|
||||
func miniPortShift(t *testing.T) int {
|
||||
t.Helper()
|
||||
defaults := []int{9180, 9201, 9202, 9203, 4420, 9333, 19333, 9340, 19340, 8888, 18888, 12535, 22535}
|
||||
for i := 0; i < 200; i++ {
|
||||
shift := 3000 + rand.Intn(6000)
|
||||
free := true
|
||||
for _, p := range defaults {
|
||||
if !claimHostPort(p + shift) {
|
||||
free = false
|
||||
break
|
||||
}
|
||||
ln, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", p+shift))
|
||||
if err != nil {
|
||||
free = false
|
||||
break
|
||||
}
|
||||
ln.Close()
|
||||
}
|
||||
if free {
|
||||
return shift
|
||||
}
|
||||
}
|
||||
t.Fatal("no --port-shift with every mini port claimed and free")
|
||||
return 0
|
||||
}
|
||||
|
||||
func exists(p string) bool {
|
||||
_, err := os.Stat(p)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// Expected command words follow the printed POSIX-shell contract.
|
||||
func miniHintWord(s string) string {
|
||||
if s != "" && strings.Trim(s, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@%+=:,./_-") == "" {
|
||||
return s
|
||||
}
|
||||
return "'" + strings.ReplaceAll(s, "'", `'\''`) + "'"
|
||||
}
|
||||
|
||||
func miniLockConflict(path string) error {
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
err = syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB)
|
||||
if err == syscall.EWOULDBLOCK || err == syscall.EAGAIN {
|
||||
return nil
|
||||
}
|
||||
if err == nil {
|
||||
_ = syscall.Flock(int(f.Fd()), syscall.LOCK_UN)
|
||||
return fmt.Errorf("lock was available")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func TestMiniLockProofRequiresContention(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "v1.lock")
|
||||
f, err := os.Create(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer f.Close()
|
||||
if err := miniLockConflict(path); err == nil {
|
||||
t.Fatal("unheld file passed the serving-lock proof")
|
||||
}
|
||||
if err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := miniLockConflict(path); err != nil {
|
||||
t.Fatalf("held lock failed proof: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,578 @@
|
||||
//go:build linux && subprocess && chunkstore_integration
|
||||
|
||||
package main_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// Preconditions are assertions: a privileged run is not non-root evidence.
|
||||
func assertMiniUnprivileged(t *testing.T) {
|
||||
t.Helper()
|
||||
if os.Getuid() == 0 || os.Geteuid() == 0 {
|
||||
t.Fatal("non-root qualification must run without uid 0")
|
||||
}
|
||||
p := "/run/sw-block/locks"
|
||||
// A read-only existing file can still be flocked without a directory write.
|
||||
// Refuse qualification if it can even be opened; never mutate the host path.
|
||||
lock, err := os.Open(filepath.Join(p, "v1.lock"))
|
||||
if err == nil {
|
||||
_ = lock.Close()
|
||||
t.Fatal("existing host lock is readable; old host-lock path is usable")
|
||||
}
|
||||
if !errors.Is(err, os.ErrNotExist) && !errors.Is(err, syscall.EACCES) && !errors.Is(err, syscall.EPERM) {
|
||||
t.Fatalf("host lock file preflight: %v", err)
|
||||
}
|
||||
for {
|
||||
_, err := os.Stat(p)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
if errors.Is(err, syscall.EACCES) || errors.Is(err, syscall.EPERM) {
|
||||
t.Logf("non-root uid=%d euid=%d; host lock path %s is inaccessible: %v", os.Getuid(), os.Geteuid(), p, err)
|
||||
return
|
||||
}
|
||||
if !errors.Is(err, os.ErrNotExist) {
|
||||
t.Fatalf("host lock preflight: %v", err)
|
||||
}
|
||||
p = filepath.Dir(p)
|
||||
}
|
||||
if err := syscall.Access(p, 3); err == nil {
|
||||
t.Fatalf("host lock path/ancestor %s is writable; non-root precondition is unproved", p)
|
||||
} else if !errors.Is(err, syscall.EACCES) && !errors.Is(err, syscall.EPERM) {
|
||||
t.Fatalf("host lock access preflight: %v", err)
|
||||
}
|
||||
t.Logf("non-root uid=%d euid=%d; host lock ancestor %s is not writable", os.Getuid(), os.Geteuid(), p)
|
||||
}
|
||||
|
||||
type miniOutput struct {
|
||||
mu sync.Mutex
|
||||
b bytes.Buffer
|
||||
}
|
||||
|
||||
func (b *miniOutput) Write(p []byte) (int, error) {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
return b.b.Write(p)
|
||||
}
|
||||
func (b *miniOutput) String() string { b.mu.Lock(); defer b.mu.Unlock(); return b.b.String() }
|
||||
|
||||
const miniFailStopExit = 86
|
||||
|
||||
func miniFailStop(t *testing.T, why string) {
|
||||
fmt.Fprintf(os.Stderr, "%s: %s; stopping tests before directory cleanup\n", t.Name(), why)
|
||||
os.Exit(miniFailStopExit)
|
||||
}
|
||||
|
||||
type ownedMini struct {
|
||||
cmd *exec.Cmd
|
||||
done chan struct{}
|
||||
err error
|
||||
output miniOutput
|
||||
stopOnce sync.Once
|
||||
mu sync.Mutex
|
||||
settled bool
|
||||
leaderFD int
|
||||
leaderKey string
|
||||
dispatches atomic.Int64
|
||||
watchdog atomic.Bool
|
||||
// Only the isolated fail-stop controls replace the census or its window.
|
||||
groupExists func() bool
|
||||
census func() []int
|
||||
censusWait time.Duration
|
||||
captureLeader func(int) (miniProcInfo, error)
|
||||
}
|
||||
|
||||
const miniShutdownGrace = 35 * time.Second // three 10-second child stops plus margin
|
||||
|
||||
// Probe before starting any workload. CLONE_PIDFD then obtains the child's
|
||||
// immutable reference atomically with creation, before a cancellation can run.
|
||||
func miniPidfdSupport() error {
|
||||
fd, err := unix.PidfdOpen(os.Getpid(), 0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer unix.Close(fd)
|
||||
return unix.PidfdSendSignal(fd, 0, nil, 0)
|
||||
}
|
||||
func startOwnedMini(t *testing.T, ctx context.Context, bin string, args ...string) *ownedMini {
|
||||
t.Helper()
|
||||
if err := miniPidfdSupport(); err != nil {
|
||||
t.Fatalf("pidfd ownership unavailable before start: %v", err)
|
||||
}
|
||||
p := &ownedMini{cmd: exec.CommandContext(ctx, bin, args...), done: make(chan struct{}), leaderFD: -1}
|
||||
p.cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true, PidFD: &p.leaderFD}
|
||||
p.cmd.Stdout, p.cmd.Stderr = &p.output, &p.output
|
||||
// os/exec must not kill only the leader after a short WaitDelay. Our
|
||||
// watchdog grants the full product shutdown window, then owns group cleanup.
|
||||
p.cmd.Cancel = func() error { p.watchdog.Store(true); go p.stop(t); return nil }
|
||||
p.mu.Lock() // a context cancellation cannot observe the unopened pidfd
|
||||
if err := p.cmd.Start(); err != nil {
|
||||
p.mu.Unlock()
|
||||
t.Fatal(err)
|
||||
}
|
||||
if p.leaderFD < 0 {
|
||||
p.mu.Unlock()
|
||||
p.ownershipFailed(t, "atomic leader pidfd missing")
|
||||
}
|
||||
info, err := miniProc(p.cmd.Process.Pid)
|
||||
if err != nil {
|
||||
p.mu.Unlock()
|
||||
p.ownershipFailed(t, fmt.Sprintf("cannot record leader incarnation: %v", err))
|
||||
}
|
||||
p.leaderKey = info.key
|
||||
p.mu.Unlock()
|
||||
go func() { p.err = p.cmd.Wait(); close(p.done) }()
|
||||
t.Cleanup(func() { p.stop(t) })
|
||||
return p
|
||||
}
|
||||
|
||||
// No Wait goroutine exists yet: the unreaped direct child cannot have its
|
||||
// PID recycled. Stop and reap it before failing closed with directories kept.
|
||||
func (p *ownedMini) ownershipFailed(t *testing.T, why string) {
|
||||
_ = p.cmd.Process.Kill()
|
||||
p.cmd.WaitDelay = time.Second
|
||||
reaped := make(chan struct{})
|
||||
go func() { _ = p.cmd.Wait(); close(reaped) }()
|
||||
select {
|
||||
case <-reaped:
|
||||
case <-time.After(5 * time.Second):
|
||||
}
|
||||
miniFailStop(t, why)
|
||||
}
|
||||
func (p *ownedMini) signalFD(fd int, sig unix.Signal) error {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
if p.settled {
|
||||
return os.ErrProcessDone
|
||||
}
|
||||
p.dispatches.Add(1)
|
||||
return unix.PidfdSendSignal(fd, sig, nil, 0)
|
||||
}
|
||||
func (p *ownedMini) signalLeader(sig unix.Signal) error {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
if p.settled {
|
||||
return os.ErrProcessDone
|
||||
}
|
||||
p.dispatches.Add(1)
|
||||
return unix.PidfdSendSignal(p.leaderFD, sig, nil, 0)
|
||||
}
|
||||
func (p *ownedMini) isSettled() bool { p.mu.Lock(); defer p.mu.Unlock(); return p.settled }
|
||||
func (p *ownedMini) settle() {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
if !p.settled {
|
||||
p.settled = true
|
||||
if p.leaderFD >= 0 {
|
||||
_ = unix.Close(p.leaderFD)
|
||||
p.leaderFD = -1
|
||||
}
|
||||
}
|
||||
}
|
||||
func (p *ownedMini) join(t *testing.T, bound time.Duration) error {
|
||||
t.Helper()
|
||||
select {
|
||||
case <-p.done:
|
||||
return p.err
|
||||
case <-time.After(bound):
|
||||
miniFailStop(t, fmt.Sprintf("owned process did not join in %s", bound))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
func (p *ownedMini) assertNaturalExit(t *testing.T) {
|
||||
t.Helper()
|
||||
if p.watchdog.Load() {
|
||||
t.Fatal("watchdog intervened; failed-start cleanup was not completed by mini")
|
||||
}
|
||||
}
|
||||
func (p *ownedMini) stop(t *testing.T) {
|
||||
p.stopOnce.Do(func() {
|
||||
if p.isSettled() {
|
||||
return
|
||||
}
|
||||
_ = p.signalLeader(unix.SIGTERM)
|
||||
select {
|
||||
case <-p.done:
|
||||
p.assertStopped(t)
|
||||
return
|
||||
case <-time.After(miniShutdownGrace):
|
||||
}
|
||||
p.stopGroup(t)
|
||||
})
|
||||
}
|
||||
|
||||
// Never signal a numeric PGID. While the original leader is stopped, its
|
||||
// group identity cannot disappear; capture and stop each member by pidfd.
|
||||
// After resuming, TERM/KILL use those immutable references even if a PID is
|
||||
// recycled. Unknown late members or an exited leader with live residue cause
|
||||
// fail-stop rather than guessing ownership and signaling an unrelated group.
|
||||
func (p *ownedMini) stopGroup(t *testing.T) {
|
||||
t.Helper()
|
||||
if p.isSettled() {
|
||||
return
|
||||
}
|
||||
select {
|
||||
case <-p.done:
|
||||
p.assertStopped(t)
|
||||
return
|
||||
default:
|
||||
}
|
||||
if err := p.signalLeader(unix.SIGSTOP); err != nil {
|
||||
select {
|
||||
case <-p.done:
|
||||
p.assertStopped(t)
|
||||
return
|
||||
default:
|
||||
miniFailStop(t, fmt.Sprintf("cannot stop owned leader: %v", err))
|
||||
}
|
||||
}
|
||||
pgid := p.cmd.Process.Pid
|
||||
leaderFD := p.leaderFD
|
||||
refs := map[string]int{}
|
||||
defer func() {
|
||||
for _, fd := range refs {
|
||||
if fd != leaderFD {
|
||||
_ = unix.Close(fd)
|
||||
}
|
||||
}
|
||||
}()
|
||||
deadline := time.Now().Add(time.Second)
|
||||
for {
|
||||
select {
|
||||
case <-p.done:
|
||||
p.assertStopped(t)
|
||||
return
|
||||
default:
|
||||
}
|
||||
readLeader := miniProc
|
||||
if p.captureLeader != nil {
|
||||
readLeader = p.captureLeader
|
||||
}
|
||||
leader, err := readLeader(pgid)
|
||||
if err != nil || leader.key != p.leaderKey || (leader.state != "T" && leader.state != "t") || unix.PidfdSendSignal(leaderFD, 0, nil, 0) != nil {
|
||||
if time.Now().After(deadline) {
|
||||
miniFailStop(t, "leader incarnation not held during member capture")
|
||||
}
|
||||
time.Sleep(5 * time.Millisecond)
|
||||
continue
|
||||
}
|
||||
refs[leader.key] = leaderFD
|
||||
members := miniGroupMembers(t, pgid)
|
||||
stopped := true
|
||||
for _, m := range members {
|
||||
fd, ok := refs[m.key]
|
||||
if !ok {
|
||||
fd, err = unix.PidfdOpen(m.pid, 0)
|
||||
if err != nil {
|
||||
if errors.Is(err, unix.ESRCH) {
|
||||
stopped = false
|
||||
continue
|
||||
}
|
||||
miniFailStop(t, fmt.Sprintf("cannot own descendant: %v", err))
|
||||
}
|
||||
current, err := miniProc(m.pid)
|
||||
if err != nil || current.key != m.key || current.group != pgid {
|
||||
_ = unix.Close(fd)
|
||||
stopped = false
|
||||
continue
|
||||
}
|
||||
refs[m.key] = fd
|
||||
}
|
||||
if m.state != "T" && m.state != "t" {
|
||||
stopped = false
|
||||
if err := p.signalFD(fd, unix.SIGSTOP); err != nil && !errors.Is(err, unix.ESRCH) {
|
||||
miniFailStop(t, fmt.Sprintf("cannot stop descendant: %v", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
if stopped {
|
||||
break
|
||||
}
|
||||
if time.Now().After(deadline) {
|
||||
miniFailStop(t, "descendant capture did not quiesce")
|
||||
}
|
||||
time.Sleep(5 * time.Millisecond)
|
||||
}
|
||||
for _, fd := range refs {
|
||||
_ = p.signalFD(fd, unix.SIGTERM)
|
||||
}
|
||||
for _, fd := range refs {
|
||||
_ = p.signalFD(fd, unix.SIGCONT)
|
||||
}
|
||||
select {
|
||||
case <-p.done:
|
||||
case <-time.After(2 * time.Second):
|
||||
}
|
||||
for _, fd := range refs {
|
||||
_ = p.signalFD(fd, unix.SIGKILL)
|
||||
}
|
||||
_ = p.join(t, 5*time.Second)
|
||||
p.assertStopped(t)
|
||||
}
|
||||
func (p *ownedMini) assertStopped(t *testing.T) {
|
||||
t.Helper()
|
||||
wait := p.censusWait
|
||||
if wait == 0 {
|
||||
wait = 5 * time.Second
|
||||
}
|
||||
deadline := time.Now().Add(wait)
|
||||
for {
|
||||
var live []int
|
||||
if p.census != nil {
|
||||
live = p.census()
|
||||
} else {
|
||||
live = miniGroupLive(t, p.cmd.Process.Pid)
|
||||
}
|
||||
// A /proc listing is not atomic: a member can fork then disappear
|
||||
// between list and stat. Signal 0 is only an existence query (never a
|
||||
// numeric effect signal); ESRCH proves the entire group is now absent.
|
||||
absent := false
|
||||
if p.groupExists != nil {
|
||||
absent = !p.groupExists()
|
||||
} else {
|
||||
err := unix.Kill(-p.cmd.Process.Pid, 0)
|
||||
absent = errors.Is(err, unix.ESRCH)
|
||||
}
|
||||
if len(live) == 0 && absent {
|
||||
select {
|
||||
case <-p.done:
|
||||
p.settle()
|
||||
return
|
||||
default:
|
||||
miniFailStop(t, "empty group but leader not joined")
|
||||
}
|
||||
}
|
||||
if time.Now().After(deadline) {
|
||||
miniFailStop(t, fmt.Sprintf("owned group has live residue %v", live))
|
||||
}
|
||||
time.Sleep(5 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
type miniProcInfo struct {
|
||||
pid, group int
|
||||
state, key string
|
||||
}
|
||||
|
||||
func miniProc(pid int) (miniProcInfo, error) {
|
||||
b, err := os.ReadFile(filepath.Join("/proc", strconv.Itoa(pid), "stat"))
|
||||
if err != nil {
|
||||
return miniProcInfo{}, err
|
||||
}
|
||||
end := strings.LastIndexByte(string(b), ')')
|
||||
if end < 0 {
|
||||
return miniProcInfo{}, fmt.Errorf("invalid proc stat")
|
||||
}
|
||||
fields := strings.Fields(string(b[end+1:]))
|
||||
if len(fields) < 20 {
|
||||
return miniProcInfo{}, fmt.Errorf("short proc stat")
|
||||
}
|
||||
group, err := strconv.Atoi(fields[2])
|
||||
if err != nil {
|
||||
return miniProcInfo{}, err
|
||||
}
|
||||
return miniProcInfo{pid: pid, group: group, state: fields[0], key: strconv.Itoa(pid) + ":" + fields[19]}, nil
|
||||
}
|
||||
func miniGroupMembers(t *testing.T, pgid int) []miniProcInfo {
|
||||
entries, err := os.ReadDir("/proc")
|
||||
if err != nil {
|
||||
miniFailStop(t, err.Error())
|
||||
}
|
||||
var members []miniProcInfo
|
||||
for _, entry := range entries {
|
||||
pid, err := strconv.Atoi(entry.Name())
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
info, err := miniProc(pid)
|
||||
if errors.Is(err, os.ErrNotExist) || errors.Is(err, unix.ESRCH) {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
miniFailStop(t, err.Error())
|
||||
}
|
||||
if info.group == pgid && info.state != "Z" && info.state != "X" {
|
||||
members = append(members, info)
|
||||
}
|
||||
}
|
||||
return members
|
||||
}
|
||||
func miniGroupLive(t *testing.T, pgid int) []int {
|
||||
var live []int
|
||||
for _, m := range miniGroupMembers(t, pgid) {
|
||||
live = append(live, m.pid)
|
||||
}
|
||||
return live
|
||||
}
|
||||
|
||||
// An intentionally TERM-ignoring descendant exercises the safety net itself.
|
||||
func TestMiniOwnedGroupCleanupStopsDescendants(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
defer cancel()
|
||||
p := startOwnedMini(t, ctx, "/bin/sh", "-c", "trap '' TERM; sleep 60 & echo ready; wait")
|
||||
deadline := time.Now().Add(5 * time.Second)
|
||||
for !strings.Contains(p.output.String(), "ready") {
|
||||
if time.Now().After(deadline) {
|
||||
t.Fatal("fixture did not start")
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
if live := miniGroupLive(t, p.cmd.Process.Pid); len(live) < 2 {
|
||||
t.Fatalf("descendant fixture not reached: %v", live)
|
||||
}
|
||||
p.stop(t)
|
||||
select {
|
||||
case <-p.done:
|
||||
default:
|
||||
t.Fatal("leader not joined")
|
||||
}
|
||||
}
|
||||
|
||||
// This real process settles normally before its registered cleanup runs. A
|
||||
// later cleanup must not dispatch anything to its old group or descriptor.
|
||||
func TestMiniSettledCleanupDoesNotSignal(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
p := startOwnedMini(t, ctx, "/bin/true")
|
||||
if err := p.join(t, 3*time.Second); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
p.assertStopped(t)
|
||||
before := p.dispatches.Load()
|
||||
p.stop(t)
|
||||
if got := p.dispatches.Load(); got != before {
|
||||
t.Fatalf("settled cleanup dispatched %d signals", got-before)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMiniCleanupFailStopAndSettlement(t *testing.T) {
|
||||
for _, mode := range []string{"join", "residue", "missed-member", "settled", "capture-settled", "capture-residue", "natural", "watchdog"} {
|
||||
t.Run(mode, func(t *testing.T) {
|
||||
marker := filepath.Join(t.TempDir(), "cleanup-ran")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
self, err := os.Executable()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Setenv("MINI_CLEANUP_CONTROL", mode)
|
||||
t.Setenv("MINI_CLEANUP_MARKER", marker)
|
||||
p := startOwnedMini(t, ctx, self, "-test.run=^TestMiniCleanupFailStopHelper$")
|
||||
err = p.join(t, 3*time.Second)
|
||||
p.assertStopped(t)
|
||||
_, statErr := os.Stat(marker)
|
||||
if mode == "settled" || mode == "capture-settled" || mode == "natural" {
|
||||
if err != nil || statErr != nil {
|
||||
t.Fatalf("positive cleanup twin: err=%v marker=%v", err, statErr)
|
||||
}
|
||||
} else if mode == "watchdog" {
|
||||
var exit *exec.ExitError
|
||||
if !errors.As(err, &exit) || exit.ExitCode() != 1 || !strings.Contains(p.output.String(), "watchdog intervened") || statErr != nil {
|
||||
t.Fatalf("watchdog cannot prove natural cleanup: err=%v marker=%v output=%s", err, statErr, p.output.String())
|
||||
}
|
||||
} else {
|
||||
var exit *exec.ExitError
|
||||
if !errors.As(err, &exit) || exit.ExitCode() != miniFailStopExit || !errors.Is(statErr, os.ErrNotExist) {
|
||||
t.Fatalf("fail-stop %s: err=%v marker=%v output=%s", mode, err, statErr, p.output.String())
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
func TestMiniCleanupFailStopHelper(t *testing.T) {
|
||||
mode := os.Getenv("MINI_CLEANUP_CONTROL")
|
||||
if mode == "" {
|
||||
t.Skip("isolated fail-stop helper")
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
if err := os.WriteFile(os.Getenv("MINI_CLEANUP_MARKER"), []byte("cleanup ran"), 0o600); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
})
|
||||
p := &ownedMini{done: make(chan struct{}), leaderFD: -1, censusWait: 10 * time.Millisecond, groupExists: func() bool { return false }}
|
||||
switch mode {
|
||||
case "join":
|
||||
p.join(t, 10*time.Millisecond)
|
||||
case "residue":
|
||||
close(p.done)
|
||||
p.census = func() []int { return []int{1234} }
|
||||
p.assertStopped(t)
|
||||
case "missed-member":
|
||||
close(p.done)
|
||||
p.census = func() []int { return nil }
|
||||
p.groupExists = func() bool { return true }
|
||||
p.assertStopped(t)
|
||||
case "settled":
|
||||
close(p.done)
|
||||
p.census = func() []int { return nil }
|
||||
p.assertStopped(t)
|
||||
case "capture-settled", "capture-residue":
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
p := startOwnedMini(t, ctx, "/bin/sleep", "60")
|
||||
p.censusWait = 10 * time.Millisecond
|
||||
if mode == "capture-residue" {
|
||||
p.census = func() []int { return []int{1234} }
|
||||
p.groupExists = func() bool { return true }
|
||||
}
|
||||
p.captureLeader = func(int) (miniProcInfo, error) {
|
||||
_ = p.signalLeader(unix.SIGKILL)
|
||||
_ = p.join(t, time.Second)
|
||||
return miniProcInfo{}, os.ErrNotExist
|
||||
}
|
||||
p.stopGroup(t)
|
||||
case "natural", "watchdog":
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
bin, args := "/bin/false", []string{}
|
||||
if mode == "watchdog" {
|
||||
bin, args = "/bin/sleep", []string{"60"}
|
||||
}
|
||||
p := startOwnedMini(t, ctx, bin, args...)
|
||||
if mode == "watchdog" {
|
||||
cancel()
|
||||
}
|
||||
_ = p.join(t, time.Second)
|
||||
p.assertStopped(t)
|
||||
p.assertNaturalExit(t)
|
||||
default:
|
||||
t.Fatal("invalid control")
|
||||
}
|
||||
}
|
||||
|
||||
// A four-second shutdown exceeds the old WaitDelay. The context watchdog
|
||||
// must let it finish rather than kill its leader before children are stopped.
|
||||
func TestMiniContextAllowsChildShutdownGrace(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
p := startOwnedMini(t, ctx, "/bin/sh", "-c", "trap 'sleep 4; echo graceful; exit 0' TERM; echo ready; while :; do sleep .05; done")
|
||||
deadline := time.Now().Add(5 * time.Second)
|
||||
for !strings.Contains(p.output.String(), "ready") {
|
||||
if time.Now().After(deadline) {
|
||||
t.Fatal("shutdown fixture not ready")
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
cancel()
|
||||
_ = p.join(t, miniShutdownGrace+10*time.Second)
|
||||
p.assertStopped(t)
|
||||
if !strings.Contains(p.output.String(), "graceful") {
|
||||
t.Fatalf("shutdown killed prematurely: %s", p.output.String())
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/durable"
|
||||
)
|
||||
|
||||
// The test lock directory override is refused under systemd
|
||||
@@ -50,3 +52,19 @@ func TestVolumeLockDirTestOnlyHiddenFromHelp(t *testing.T) {
|
||||
t.Fatalf("--help lists the test override:\n%s", out)
|
||||
}
|
||||
}
|
||||
|
||||
// Without the override the lock directory stays the host one: the provider
|
||||
// gets no override, so it uses durable.HostVolumeLockDir.
|
||||
func TestVolumeLockDirDefaultIsTheHostDirectory(t *testing.T) {
|
||||
t.Setenv("INVOCATION_ID", "")
|
||||
f, err := parseFlags(append(phase150RequiredBlockvolumeArgs(), "--durable-root="+t.TempDir(), "--durable-impl=walstore"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if f.volumeLockDirTestOnly != "" {
|
||||
t.Fatalf("a default start overrides the lock directory: %q", f.volumeLockDirTestOnly)
|
||||
}
|
||||
if durable.HostVolumeLockDir != "/run/sw-block/locks" {
|
||||
t.Fatalf("the host lock directory moved: %s", durable.HostVolumeLockDir)
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,9 @@ type miniConfig struct {
|
||||
// Explicit names the flags given on the command line (fs.Visit); a
|
||||
// --reuse refuses one that differs from the recorded run.
|
||||
Explicit map[string]bool
|
||||
// Self and WeedPath are the absolute paths of this sw-block and of the
|
||||
// weed it runs, for the commands mini prints; empty in unit tests.
|
||||
Self, WeedPath string
|
||||
}
|
||||
|
||||
// miniRecord is what a fresh start records in <dir>/mini.json and --reuse
|
||||
@@ -98,6 +101,23 @@ type miniRecord struct {
|
||||
|
||||
const miniRecordFile = "mini.json"
|
||||
|
||||
// Make an executable path absolute without collapsing symlink/.. components.
|
||||
func miniExecutablePath(path string) (string, error) {
|
||||
if filepath.IsAbs(path) {
|
||||
return path, nil
|
||||
}
|
||||
volume := filepath.VolumeName(path)
|
||||
base, err := filepath.Abs(volume + ".")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
relative := strings.TrimPrefix(path, volume)
|
||||
if len(relative) > 0 && os.IsPathSeparator(relative[0]) {
|
||||
return filepath.VolumeName(base) + relative, nil
|
||||
}
|
||||
return base + string(os.PathSeparator) + relative, nil
|
||||
}
|
||||
|
||||
func writeMiniRecord(dir string, r miniRecord) error {
|
||||
b, err := json.MarshalIndent(r, "", " ")
|
||||
if err != nil {
|
||||
@@ -118,6 +138,13 @@ func reuseMiniRecord(c *miniConfig, weedFound string) (string, error) {
|
||||
if err := json.Unmarshal(b, &r); err != nil {
|
||||
return "", fmt.Errorf("--reuse: %s/%s: %w", c.Dir, miniRecordFile, err)
|
||||
}
|
||||
if r.Weed != "" {
|
||||
abs, err := miniExecutablePath(r.Weed)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("--reuse: resolve weed path: %w", err)
|
||||
}
|
||||
r.Weed = abs
|
||||
}
|
||||
differs := func(flag string, now, then any) error {
|
||||
if c.Explicit[flag] && fmt.Sprint(now) != fmt.Sprint(then) {
|
||||
return fmt.Errorf("--reuse: --%s %v differs from this dir's run (%v); drop it to reuse the run as recorded", flag, now, then)
|
||||
@@ -186,9 +213,16 @@ func miniMasterArgs(c miniConfig, chunk bool) []string {
|
||||
}
|
||||
|
||||
// miniVolumeArgs is blockvolume as swb_start runs it, plus, with a chunk
|
||||
// store, the walstore-chunk settings and the volume's layout id.
|
||||
// store, the walstore-chunk settings and the volume's layout id. Its volume
|
||||
// lock is under the run's dir, so mini needs no root and no tmpfiles.d entry
|
||||
// (a trial override, which blockvolume refuses under systemd); with a chunk
|
||||
// store it takes no scheduled snapshot (mini prints how to take one).
|
||||
func miniVolumeArgs(c miniConfig, chunk bool, layoutID string) []string {
|
||||
return miniVolumeSpec(c, chunk, layoutID).args()
|
||||
a := append(miniVolumeSpec(c, chunk, layoutID).args(), "--volume-lock-dir-test-only", filepath.Join(c.Dir, "locks"))
|
||||
if chunk {
|
||||
a = append(a, "--chunk-snapshot-schedule", "off")
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
// miniVolumeSpec is mini's v1: the same settings volume start writes for a
|
||||
@@ -275,6 +309,14 @@ func (r *miniRun) start(name, bin string, args []string) (*miniChild, error) {
|
||||
}
|
||||
cmd := exec.Command(bin, args...)
|
||||
cmd.Stdout, cmd.Stderr, cmd.Stdin = lf, lf, nil
|
||||
cmd.Env = []string{}
|
||||
// mini's children are not systemd units even when mini runs under one;
|
||||
// blockvolume refuses mini's lock directory while INVOCATION_ID is set.
|
||||
for _, kv := range os.Environ() {
|
||||
if !strings.HasPrefix(kv, "INVOCATION_ID=") {
|
||||
cmd.Env = append(cmd.Env, kv)
|
||||
}
|
||||
}
|
||||
if err := cmd.Start(); err != nil {
|
||||
lf.Close()
|
||||
return nil, fmt.Errorf("start %s: %w", name, err)
|
||||
@@ -319,6 +361,30 @@ func (r *miniRun) ready(ctx context.Context, c *miniChild, ports ...int) error {
|
||||
}
|
||||
}
|
||||
|
||||
// resolveLayoutID looks up volume's layout id through blockmaster,
|
||||
// retrying while blockmaster registers it, bounded by miniResolveWait.
|
||||
func (r *miniRun) resolveLayoutID(ctx context.Context, master, volume string) (string, error) {
|
||||
deadline := time.Now().Add(miniResolveWait)
|
||||
for {
|
||||
rctx, rcancel := context.WithTimeout(ctx, 5*time.Second)
|
||||
id, err := resolveVolumeID(rctx, master, volume)
|
||||
rcancel()
|
||||
if err == nil {
|
||||
return id.String(), nil
|
||||
}
|
||||
if d := r.dead(); d != nil {
|
||||
return "", fmt.Errorf("%s exited while resolving %s's layout id: %v", d.name, volume, d.err)
|
||||
}
|
||||
if ctx.Err() != nil || time.Now().After(deadline) {
|
||||
return "", fmt.Errorf("resolve %s's layout id: %v", volume, err)
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
case <-time.After(time.Second):
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dead is the first child that has exited, if any.
|
||||
func (r *miniRun) dead() *miniChild {
|
||||
for _, c := range r.children {
|
||||
@@ -415,6 +481,16 @@ func mini(ctx context.Context, cfg miniConfig, stdout, stderr io.Writer) (int, e
|
||||
} else if st, err := os.Stat(weed); err != nil || st.IsDir() {
|
||||
return ops.VolumeStatusExitInvalid, fmt.Errorf("--weed %s not found", weed)
|
||||
}
|
||||
if weed != "" {
|
||||
abs, err := miniExecutablePath(weed)
|
||||
if err != nil {
|
||||
return ops.VolumeStatusExitInvalid, fmt.Errorf("resolve weed path: %w", err)
|
||||
}
|
||||
weed = abs
|
||||
if cfg.Weed != "" {
|
||||
cfg.Weed = abs
|
||||
}
|
||||
}
|
||||
// A reuse takes the recorded run (its binaries included) before any
|
||||
// lookup; a fresh start finds the binaries next to sw-block by default.
|
||||
if cfg.Reuse {
|
||||
@@ -482,7 +558,11 @@ func mini(ctx context.Context, cfg miniConfig, stdout, stderr io.Writer) (int, e
|
||||
return 1, err
|
||||
}
|
||||
}
|
||||
for _, d := range []string{filepath.Join(cfg.Dir, "master"), filepath.Join(cfg.Dir, "vol")} {
|
||||
if exe, err := os.Executable(); err == nil {
|
||||
cfg.Self = exe
|
||||
}
|
||||
cfg.WeedPath = weed
|
||||
for _, d := range []string{filepath.Join(cfg.Dir, "master"), filepath.Join(cfg.Dir, "vol"), filepath.Join(cfg.Dir, "locks")} {
|
||||
if err := os.MkdirAll(d, 0o755); err != nil {
|
||||
return 1, err
|
||||
}
|
||||
@@ -491,6 +571,8 @@ func mini(ctx context.Context, cfg miniConfig, stdout, stderr io.Writer) (int, e
|
||||
defer r.stop()
|
||||
fail := func(err error) (int, error) {
|
||||
r.tail(20)
|
||||
r.stop()
|
||||
fmt.Fprintf(stderr, "sw-block mini: not started; logs in %s/*.log. After fixing the cause, start again on it with\n %s\nor remove %s and start fresh.\n", shQuote(cfg.Dir), miniResume(cfg), shQuote(cfg.Dir))
|
||||
return 1, err
|
||||
}
|
||||
if chunk {
|
||||
@@ -519,26 +601,9 @@ func mini(ctx context.Context, cfg miniConfig, stdout, stderr io.Writer) (int, e
|
||||
}
|
||||
layoutID := ""
|
||||
if chunk {
|
||||
fmt.Fprintf(stdout, "+ sw-block ops volume resolve --master %s %s\n", loopback(cfg.Ports.Master), miniVolume)
|
||||
deadline := time.Now().Add(miniResolveWait)
|
||||
for {
|
||||
rctx, rcancel := context.WithTimeout(ctx, 5*time.Second)
|
||||
id, err := resolveVolumeID(rctx, loopback(cfg.Ports.Master), miniVolume)
|
||||
rcancel()
|
||||
if err == nil {
|
||||
layoutID = id.String()
|
||||
break
|
||||
}
|
||||
if d := r.dead(); d != nil {
|
||||
return fail(fmt.Errorf("%s exited while resolving %s's layout id: %v", d.name, miniVolume, d.err))
|
||||
}
|
||||
if ctx.Err() != nil || time.Now().After(deadline) {
|
||||
return fail(fmt.Errorf("resolve %s's layout id: %v", miniVolume, err))
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
case <-time.After(time.Second):
|
||||
}
|
||||
fmt.Fprintf(stdout, "+ %s ops volume resolve --master %s %s\n", miniSelf(cfg), loopback(cfg.Ports.Master), miniVolume)
|
||||
if layoutID, err = r.resolveLayoutID(ctx, loopback(cfg.Ports.Master), miniVolume); err != nil {
|
||||
return fail(err)
|
||||
}
|
||||
}
|
||||
vc, err := r.start("blockvolume", volume, miniVolumeArgs(cfg, chunk, layoutID))
|
||||
@@ -598,9 +663,18 @@ func shQuote(s string) string {
|
||||
return "'" + strings.ReplaceAll(s, "'", `'\''`) + "'"
|
||||
}
|
||||
|
||||
// miniSelf is how a printed command names this sw-block: its absolute path
|
||||
// when known, so the command runs from any directory.
|
||||
func miniSelf(c miniConfig) string {
|
||||
if c.Self == "" {
|
||||
return "sw-block"
|
||||
}
|
||||
return shQuote(c.Self)
|
||||
}
|
||||
|
||||
// miniResume is the command that starts the recorded run in c.Dir again.
|
||||
func miniResume(c miniConfig) string {
|
||||
return "sw-block mini --dir " + shQuote(c.Dir) + " --reuse"
|
||||
return miniSelf(c) + " mini --dir " + shQuote(c.Dir) + " --reuse"
|
||||
}
|
||||
|
||||
// miniNextSteps prints what to run next; mini runs none of it.
|
||||
@@ -616,9 +690,14 @@ func miniNextSteps(w io.Writer, c miniConfig, chunk bool) {
|
||||
return
|
||||
}
|
||||
cmds := miniCommands(c, chunk)
|
||||
fmt.Fprintf(w, "\nCheck the volume:\n sw-block %s\n sw-block %s\n", strings.Join(cmds[0], " "), strings.Join(cmds[1], " "))
|
||||
fmt.Fprintf(w, "\nSnapshot:\n sw-block %s\n", strings.Join(cmds[2], " "))
|
||||
fmt.Fprintf(w, "\nSeaweedFS itself: weed shell -master=%s\n", loopback(c.Ports.WeedMaster))
|
||||
self := miniSelf(c)
|
||||
fmt.Fprintf(w, "\nCheck the volume:\n %s %s\n %s %s\n", self, strings.Join(cmds[0], " "), self, strings.Join(cmds[1], " "))
|
||||
fmt.Fprintf(w, "\nSnapshot (mini takes no scheduled snapshot):\n %s %s\n", self, strings.Join(cmds[2], " "))
|
||||
weed := "weed"
|
||||
if c.WeedPath != "" {
|
||||
weed = shQuote(c.WeedPath)
|
||||
}
|
||||
fmt.Fprintf(w, "\nSeaweedFS itself: %s shell -master=%s\n", weed, loopback(c.Ports.WeedMaster))
|
||||
}
|
||||
|
||||
// miniBeforeStop reminds the user, before the target goes away, to have
|
||||
|
||||
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
@@ -145,7 +146,9 @@ func TestMiniWalstoreFlagsAreThePage(t *testing.T) {
|
||||
}
|
||||
}
|
||||
for f := range got {
|
||||
if _, ok := page[f]; !ok {
|
||||
// mini keeps the volume lock under --dir, so it needs no root
|
||||
// (the page's unit uses the host lock directory).
|
||||
if _, ok := page[f]; !ok && f != "--volume-lock-dir-test-only" {
|
||||
t.Errorf("%s: mini passes %s; the page's swb_start does not", c.binary, f)
|
||||
}
|
||||
}
|
||||
@@ -344,7 +347,12 @@ func TestMiniInterruptStopsEveryChild(t *testing.T) {
|
||||
case <-time.After(30 * time.Second):
|
||||
t.Fatal("mini did not stop")
|
||||
}
|
||||
for _, want := range []string{"if v1 is connected: unmount it, then sudo nvme disconnect -n nqn.test:v1", "The data stays in " + c.Dir, " " + miniResume(c) + "\n"} {
|
||||
self, err := os.Executable()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
resume := miniResume(miniConfig{Dir: c.Dir, Self: self})
|
||||
for _, want := range []string{"if v1 is connected: unmount it, then sudo nvme disconnect -n nqn.test:v1", "The data stays in " + c.Dir, " " + resume + "\n"} {
|
||||
if !strings.Contains(out.String(), want) {
|
||||
t.Fatalf("at stop, output lacks %q:\n%s", want, out.String())
|
||||
}
|
||||
@@ -442,7 +450,8 @@ func wantChunkCommands(dir, id string) map[string][]string {
|
||||
"--data-addr", "127.0.0.1:9201", "--ctrl-addr", "127.0.0.1:9202", "--status-addr", "127.0.0.1:9203",
|
||||
"--durable-root", filepath.Join(dir, "vol"), "--durable-impl", "walstore-chunk", "--durable-blocks", "65536", "--durable-blocksize", "4096",
|
||||
"--chunk-filer", "127.0.0.1:18888", "--chunk-path", "/swblock/chunks", "--chunk-control-endpoint", "--workspace-lease", "--layout-id", id,
|
||||
"--nvme-listen", "127.0.0.1:4420", "--nvme-subsysnqn", "nqn.2026-05.io.seaweedfs:v1"},
|
||||
"--nvme-listen", "127.0.0.1:4420", "--nvme-subsysnqn", "nqn.2026-05.io.seaweedfs:v1",
|
||||
"--volume-lock-dir-test-only", filepath.Join(dir, "locks"), "--chunk-snapshot-schedule", "off"},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,6 +586,47 @@ func TestMiniWeedDyingDuringStartupStopsTheRest(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMiniRelativeWeedIsRecordedAndPrintedAbsolutely(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("signals and listening children: Linux")
|
||||
}
|
||||
t.Setenv("SWB_MINI_FAKE_CHILD", "die-weed")
|
||||
bin := fakeBin(t)
|
||||
abs := filepath.Join(bin, "weed")
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rel, err := filepath.Rel(cwd, abs)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
c := miniConfig{Dir: filepath.Join(t.TempDir(), "run"), Bin: bin, Weed: rel, NQN: "n", SizeBytes: 1 << 20, Ports: freePorts(t)}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
defer cancel()
|
||||
out := &syncBuf{}
|
||||
code, err := mini(ctx, c, out, io.Discard)
|
||||
if code == 0 || err == nil {
|
||||
t.Fatalf("fixture must reach the dying weed: code=%d err=%v", code, err)
|
||||
}
|
||||
b, err := os.ReadFile(filepath.Join(c.Dir, miniRecordFile))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var record miniRecord
|
||||
if err := json.Unmarshal(b, &record); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
selected, selectedErr := os.Stat(abs)
|
||||
recorded, recordedErr := os.Stat(record.Weed)
|
||||
if selectedErr != nil || recordedErr != nil || !filepath.IsAbs(record.Weed) || !os.SameFile(selected, recorded) {
|
||||
t.Errorf("record weed=%q changed selected executable %q", record.Weed, abs)
|
||||
}
|
||||
if !strings.Contains(out.String(), "+ "+record.Weed+" ") {
|
||||
t.Errorf("relative weed command: %s", out.String())
|
||||
}
|
||||
}
|
||||
|
||||
// --reuse starts the recorded run again: its size, ports, mode (its weed)
|
||||
// and NQN, whatever the defaults are; a flag that differs from the record
|
||||
// is refused, and so are a recorded weed that is gone and a walstore run
|
||||
@@ -800,3 +850,83 @@ func TestMiniPrintedResumeRunsOnASpacedDir(t *testing.T) {
|
||||
t.Fatalf("control: the unquoted line reached the dir too (exit %d)", code)
|
||||
}
|
||||
}
|
||||
|
||||
// mini started from a systemd service's process tree (a CI runner unit, a
|
||||
// terminal server) inherits INVOCATION_ID; blockvolume refuses the lock-dir
|
||||
// override under it, so mini's children must start without it.
|
||||
func TestMiniChildrenStartWithoutInvocationID(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("Unix child environment and signals")
|
||||
}
|
||||
t.Setenv("INVOCATION_ID", "0123456789abcdef")
|
||||
dir := t.TempDir()
|
||||
r := &miniRun{cfg: miniConfig{Dir: dir}, out: io.Discard, log: io.Discard}
|
||||
c, err := r.start("env", "/bin/sh", []string{"-c", `echo "id=${INVOCATION_ID-unset}"`})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
joined := false
|
||||
stop := func() {
|
||||
if joined {
|
||||
return
|
||||
}
|
||||
_ = c.cmd.Process.Signal(syscall.SIGTERM)
|
||||
select {
|
||||
case <-c.done:
|
||||
joined = true
|
||||
return
|
||||
case <-time.After(2 * time.Second):
|
||||
}
|
||||
_ = c.cmd.Process.Kill()
|
||||
select {
|
||||
case <-c.done:
|
||||
joined = true
|
||||
case <-time.After(2 * time.Second):
|
||||
fmt.Fprintln(os.Stderr, "mini child did not join; stopping tests before directory cleanup")
|
||||
os.Exit(86)
|
||||
}
|
||||
}
|
||||
t.Cleanup(stop)
|
||||
select {
|
||||
case <-c.done:
|
||||
joined = true
|
||||
case <-time.After(2 * time.Second):
|
||||
stop()
|
||||
t.Fatal("mini environment child did not finish")
|
||||
}
|
||||
b, err := os.ReadFile(filepath.Join(dir, "env.log"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := strings.TrimSpace(string(b)); got != "id=unset" {
|
||||
t.Fatalf("mini's child saw %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
// An empty filtered environment must be explicit: nil would inherit again.
|
||||
func TestMiniOnlyInvocationIDDoesNotLeak(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("Unix environment child")
|
||||
}
|
||||
saved := os.Environ()
|
||||
t.Cleanup(func() {
|
||||
os.Clearenv()
|
||||
for _, kv := range saved {
|
||||
key, value, _ := strings.Cut(kv, "=")
|
||||
_ = os.Setenv(key, value)
|
||||
}
|
||||
})
|
||||
os.Clearenv()
|
||||
TestMiniChildrenStartWithoutInvocationID(t)
|
||||
}
|
||||
|
||||
// Assert the actual weed-hint call site, not only the quoting helper. This
|
||||
// stays sensitive if formatting is correct but the hint stops calling it.
|
||||
func TestMiniProductionWeedHintQuotesItsExecutable(t *testing.T) {
|
||||
var out bytes.Buffer
|
||||
miniNextSteps(&out, miniConfig{WeedPath: "/tmp/weed's tools/weed"}, true)
|
||||
const want = `SeaweedFS itself: '/tmp/weed'\''s tools/weed' shell -master=`
|
||||
if !strings.Contains(out.String(), want) {
|
||||
t.Fatalf("production weed hint lacks %q:\n%s", want, out.String())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestMiniWeedSymlinkParentKeepsSelectedExecutable(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("Unix symlink and child-process fixture")
|
||||
}
|
||||
t.Setenv("SWB_MINI_FAKE_CHILD", "die-weed")
|
||||
bin := fakeBin(t)
|
||||
root := t.TempDir()
|
||||
for _, dir := range []string{"tools", "releases/v2"} {
|
||||
if err := os.MkdirAll(filepath.Join(root, dir), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
selected := filepath.Join(root, "releases", "weed")
|
||||
if err := os.Symlink(filepath.Join(bin, "weed"), selected); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(root, "tools", "weed"), []byte("wrong executable"), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.Symlink(filepath.Join(root, "releases", "v2"), filepath.Join(root, "tools", "current")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Chdir(root)
|
||||
rel := "tools/current/../weed"
|
||||
want, err := os.Stat(selected)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
check := func(t *testing.T, path string) {
|
||||
t.Helper()
|
||||
got, err := os.Stat(path)
|
||||
if err != nil || !filepath.IsAbs(path) || !os.SameFile(want, got) {
|
||||
t.Fatalf("selected executable changed: path=%q stat=%v", path, err)
|
||||
}
|
||||
}
|
||||
t.Run("fresh", func(t *testing.T) {
|
||||
c := miniConfig{Dir: filepath.Join(t.TempDir(), "run"), Bin: bin, Weed: rel, NQN: "n", SizeBytes: 1 << 20, Ports: freePorts(t)}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
defer cancel()
|
||||
out := &syncBuf{}
|
||||
_, _ = mini(ctx, c, out, io.Discard)
|
||||
data, err := os.ReadFile(filepath.Join(c.Dir, miniRecordFile))
|
||||
if err != nil {
|
||||
t.Fatalf("did not reach record publication: %v; %s", err, out.String())
|
||||
}
|
||||
var record miniRecord
|
||||
if err := json.Unmarshal(data, &record); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
check(t, record.Weed)
|
||||
if !strings.Contains(out.String(), "+ "+record.Weed+" ") {
|
||||
t.Fatalf("selected executable was not launched: %s", out.String())
|
||||
}
|
||||
})
|
||||
t.Run("legacy", func(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
if err := writeMiniRecord(dir, miniRecord{Weed: rel, Bin: bin, SizeBytes: 1 << 20, NQN: "n"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
c := miniConfig{Dir: dir}
|
||||
weed, err := reuseMiniRecord(&c, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
check(t, weed)
|
||||
})
|
||||
}
|
||||
@@ -395,7 +395,7 @@ stateDiagram-v2
|
||||
| StopPending | StopPending | each sleep after a completed renewal is at most `stopPendingPoll` (250 ms); a renewal already in flight is not interrupted | `core/host/volume/workspace_lease.go` `renewDelay`, `Run` | `INV-WS-STOP-PENDING-001` |
|
||||
| StopPending | Valid | only the latest detach attempt, provably not applied, with serving resumed; an applied, fenced or unknown outcome, or an older attempt's resume, leaves StopPending | `core/frontend/durable/provider_chunk.go` `resumeAfterDetach`; `core/host/volume/workspace_runtime.go` `WorkspaceStopResumed`; `core/host/volume/workspace_lease.go` `ClearStopPending` | `INV-WS-STOP-PENDING-001` |
|
||||
| Fenced | Drained, Acked | the stop callback succeeded; only then, and only when revoked, the acknowledgement is sent; a call that got no answer (`DeadlineExceeded`, `Unavailable`) is made again until the lease deadline, any other answer is final | `core/host/volume/workspace_lease.go` `drain`, `retryableAckError` | `INV-WS-REVOKE-ACK-001`, `INV-WS-REVOKE-ACK-RETRY-001` |
|
||||
| (start) | Attaching, Refused | the volume's host lock `/run/sw-block/locks/<volume id>.lock` is taken before the store opens; held by another live process, or its directory or file cannot be created or opened, refuses (`storage.ErrWALStoreLocked`, `ErrVolumeLockDirUnavailable`) | `core/frontend/durable/provider.go` `DurableProvider.lockVolumeOnHost` (from `ensureHandle`) | `INV-WS-ONE-PROCESS-PER-HOST-001` |
|
||||
| (start) | Attaching, Refused | normal starts take the volume's host lock `/run/sw-block/locks/<volume id>.lock` before the store opens (isolated non-systemd mini trials instead use their own `--dir/locks`); held by another live process, or its directory or file cannot be created or opened, refuses (`storage.ErrWALStoreLocked`, `ErrVolumeLockDirUnavailable`) | `core/frontend/durable/provider.go` `DurableProvider.lockVolumeOnHost` (from `ensureHandle`) | `INV-WS-ONE-PROCESS-PER-HOST-001` |
|
||||
| Attaching | Refused | a local root from another claim or behind HEAD's position (`layout.ErrStaleLocalRoot`): final typed refusal with a cure, no serving or retry | `core/frontend/durable/provider_layout.go` `startLayoutRoot`; `provider_chunk.go` `recoverChunk`, `chunkAuthorityWait` | `INV-WS-STALE-LOCAL-ROOT-001` |
|
||||
| (startup) | Refused | The agreed leader lists another filer or several; or all configured masters cannot agree and confirm exactly the target within 60 s (`ErrNotSingleFiler`) | `core/frontend/chunkstore/single_filer.go` `CheckSingleFiler`; `cmd/blockvolume/chunk_remote.go` `newChunkWiring` | `INV-WS-SINGLE-FILER-001` |
|
||||
| (startup) | (startup), chunk guard on or off | on only if the filer definitely refuses the probe's mismatched chunk-condition update of a disposable HEAD; then every store the catalog opens sends the chunk condition. Any other answer leaves it off (page re-read only) and refuses nothing. sw-block metadata writers run the same probe within their --timeout | `core/frontend/chunkstore/startup_head_probe.go` `checkConditionalHead`, `probeChunkCondition`, `ProbeChunkGuard`; `cmd/sw-block/chunk_b.go` `bCatalog` | `INV-WS-CHUNK-CONDITION-PROBE-001` |
|
||||
@@ -1099,7 +1099,7 @@ Notes:
|
||||
| `INV-WS-CLAIM-BEFORE-SERVE-001` | A new B holder claims HEAD at its issued epoch only after the local root is validated against the HEAD it updates; an older epoch or another holder at the same epoch is refused, and guest writes stay closed until assignment and claim. | M9 Start → Claim → Serving | `core/frontend/chunkstore/layout/start.go` `Start`; `core/frontend/durable/provider_layout.go` `startLayoutRoot` | `TestStart_ValidatesAgainstTheHeadItUpdates`, `TestStart_Refusals` (`core/frontend/chunkstore/layout/start_test.go`); `TestStart_TheClaimRechecksTheSeedRule` (`core/frontend/chunkstore/layout/start_seed_test.go`); `TestFreshStoreRefusesWriteBeforeAssignmentThenPublishesAfterClaim` (`core/frontend/durable/provider_restore_schedule_test.go`) | `INV-SNAPK-START-LINEAGE-001`, `INV-SNAPK-START-CLAIM-001` | ACTIVE |
|
||||
| `INV-VOL-GEOMETRY-FLAGS-RECORD-001` | A create-mode start whose `--durable-blocks`/`--durable-blocksize` disagree with the volume record exits 78 before any local store exists; an existing store is checked only at attach; an absent record keeps the create path; an unread record exits 75 (filer failed) or 78 (corrupt). | blockvolume startup (before the durable provider) | `cmd/blockvolume/main.go`; `cmd/blockvolume/chunk_remote.go` `geometryFlagsRefusal`; `core/frontend/chunkstore/layout/volume.go`, `start.go`, `create.go`; `core/frontend/chunkstore/catalog_b.go` | `TestGeometryFlagsRefusalComparesTheRecord`, `TestVolumeRequiresGeometry`, `TestVolumeGeometryChecksAndIsImmutable`, `TestStartGeometryMismatchPrecedesClaim`, `TestBCatalogRestoreCopiesVolumeGeometry`, `TestVolumeGeometryLivesOnlyInVolume` | K3: immutable required VOLUME geometry; Start checks the local persisted shape before claim; restores copy source geometry; no resize or compatibility path. | ACTIVE |
|
||||
| `INV-WS-STALE-LOCAL-ROOT-001` | An old or rolled-back local root is refused by `layout.Start` before serving; synchronous and deferred attach end without retry and report the typed stale-root error and cure. A fresh root at its own epoch likewise ends with `ErrMissingLocalRoot` and its cure. | M4 Claiming → Refused | `core/frontend/durable/provider_layout.go` `startLayoutRoot`; `core/frontend/durable/provider_chunk.go` `recoverChunk`, `chunkAuthorityWait`; `core/frontend/durable/provider_startup.go` `endChunkStartup` | `TestLayoutProviderRefusesEmptyOwnEpochAndRemountedOldRoot`, `TestFinalLayoutStartRefusalTable` (`core/frontend/durable/provider_layout_test.go`, `provider_layout_start_class_test.go`) | — | ACTIVE |
|
||||
| `INV-WS-ONE-PROCESS-PER-HOST-001` | One host runs at most one live blockvolume per volume: each takes the volume's exclusive host lock before its store opens and holds it until the store closes; a second is refused before it opens anything, whatever its `--durable-root`. | M4 (start) → Attaching, Refused | `core/frontend/durable/provider.go` `DurableProvider.lockVolumeOnHost` | `TestOneLiveProcessPerVolumePerHost`, `TestHostVolumeLockDirectoryCreatedOrRefused`, `TestHostVolumeLockRefusesNonDirectoryLockPath`, `TestHostVolumeLockTakesReadOnlyLockFile` (`core/frontend/durable/one_process_per_volume_test.go`); `TestHostVolumeLockCreatesParent0755AndLocks0700`, `TestHostVolumeLockKeepsExistingDirectoryModes` (`core/frontend/durable/volume_lock_parent_mode_test.go`); `TestVolumeLockDirTestOnlyRefusedUnderSystemd` (`cmd/blockvolume/volume_lock_flag_test.go`) | — | ACTIVE |
|
||||
| `INV-WS-ONE-PROCESS-PER-HOST-001` | Normal starts exclude a second process from a volume's local data with a host lock until store close. Mini puts both data and lock under --dir via the hidden test-only override, refused under INVOCATION_ID. Normal/systemd starts keep host-wide exclusion. | M4 (start) → Attaching, Refused | `core/frontend/durable/provider.go` `DurableProvider.lockVolumeOnHost` | `TestOneLiveProcessPerVolumePerHost`, `TestHostVolumeLockDirectoryCreatedOrRefused`, `TestHostVolumeLockRefusesNonDirectoryLockPath`, `TestHostVolumeLockTakesReadOnlyLockFile` (`core/frontend/durable/one_process_per_volume_test.go`); `TestHostVolumeLockCreatesParent0755AndLocks0700`, `TestHostVolumeLockKeepsExistingDirectoryModes` (`core/frontend/durable/volume_lock_parent_mode_test.go`); `TestVolumeLockDirTestOnlyRefusedUnderSystemd` (`cmd/blockvolume/volume_lock_flag_test.go`) | — | ACTIVE |
|
||||
| `INV-CHUNK-LEASE-REQUIRED-001` | Blockvolume refuses walstore-chunk startup without --workspace-lease before any host or store is opened. The refusal names concurrent acknowledging writers and acknowledged-write loss after a forced move; plain walstore startup is unchanged. | M4 startup → Refused | `cmd/blockvolume/main.go` `parseFlags` | `TestChunkVolumeRequiresWorkspaceLeaseBeforeStart` | — | ACTIVE |
|
||||
| `INV-WS-CONDITIONAL-HEAD-001` | Catalog startup requires a wrong-generation conditional update of a disposable HEAD to be definitely refused and leave its bytes and generation unchanged. Unknown probe outcomes refuse admission; cleanup failures only warn with the leftover path. No volume HEAD is used. | M4 startup → Refused | `core/frontend/chunkstore/swfs_catalog.go` `DialBCatalog`; `startup_head_probe.go` `checkConditionalHead` | `TestCatalogStartupRequiresWrongGenerationHeadRefusal`, `TestConditionalHeadNextStartCleansCrashLeftovers`, `TestConditionalHeadSweepWaitsAndLeavesNewProbes`, `TestCatalogStartupDoesNotWaitForUndeletableProbe`, `TestLayoutIdentityWriterAndReaders` | — | ACTIVE |
|
||||
| `INV-WS-CHUNK-CONDITION-PROBE-001` | Catalog startup and sw-block metadata writers turn the chunk guard on only if the filer definitely refuses a mismatched chunk-condition update of a disposable HEAD; any other answer leaves the page re-read as the only check. No version string is read; the startup log and /status/chunk name it. | M4 startup | `core/frontend/chunkstore/startup_head_probe.go` `probeChunkCondition`, `ProbeChunkGuard`; `catalog_b.go` `Store`, `MetadataGuard`, `Usage`; `cmd/sw-block/chunk_b.go` `bCatalog` | `TestTheStartupProbeTurnsTheChunkGuardOnOnlyForAFilerThatEnforcesIt` (`core/frontend/chunkstore/startup_chunk_condition_probe_test.go`), `TestAFailedChunkGuardProbeLeavesTheGuardOff` (`core/frontend/chunkstore/chunk_guard_report_test.go`), `TestCatalogStartupRequiresWrongGenerationHeadRefusal` (`core/frontend/chunkstore/startup_head_probe_test.go`), `TestStatusServer_StatusChunkUsage` (`core/host/volume/status_chunk_test.go`), `TestOpsChunkWritingCatalogRunsTheChunkConditionProbe`, `TestOpsChunkWritingCatalogProbeIsBoundedByTheTimeout` (`cmd/sw-block/chunk_guard_probe_test.go`) | MetaABA r2, checked outside the repository: guard on = `safe_chunks_equal`; the fallback is the re-read, which a chunk still queued for deletion defeats (`mut_reread_delayed`) | ACTIVE |
|
||||
@@ -1272,6 +1272,7 @@ Notes:
|
||||
| `INV-CLI-DELETE-RETRY-001` | Only the final lease barrier after a committed volume-delete reservation permits retryable true/exit 75 at its horizon. A live-holder Reserve refusal requires stopping the volume first (not_admitted, non-retryable, exit 1). No lease guard is bypassed. | M9 delete admission result projection | `cmd/sw-block/chunk_volume_delete.go` `authorityErr`; `cmd/sw-block/chunk.go` `chunkResult` | `TestVolumeDeleteAdmissionRetryAnswer`; `TestOpsChunkVolumeDeleteRefusalSaysNothingWasPersisted` | MoveAdmission.DelRead; MoveAdmission.DelMark (unchanged guards) | STUB |
|
||||
| `INV-SNAPSHOT-REPLAY-FLAG-001` | A successful same-ID snapshot admission reports replayed true without changing HEAD or its retained outcome. First creation reports false; the flag decorates only the response. | M9 snapshot outcome projection | `core/host/volume/snapshot_operation.go`, `chunk_control.go`; `cmd/sw-block/snapshot_operation.go` | `TestSnapshotReplayFlagDoesNotRewriteOutcome`, `TestSnapshotCLIUsesReplayedAdmissionAnswer` | SnapOps.Poll; SnapOps.Start (no transition change) | STUB |
|
||||
| `INV-CLI-UNSENT-REQUEST-001` | An observed operation's initial typed dial failure sends no admission and is remote_unavailable (75) through the shared classifier. A lost answer after send, or a dial failure while polling an admitted handle, retains outcome_unknown. | CLI pre-admission error projection; no server transition | `cmd/sw-block/cut_progress_poll.go` `chunkObserveHandle`; `chunkTransportFailure`, `chunkFail` | `TestPlainDetachRefusedDialIsRemoteUnavailable`, `TestPlainDetachLostAnswerAfterSendStaysUnknown`, `TestPlainDetachPollDialFailureKeepsAdmittedOutcomeUnknown`, `TestOpsChunk_ErrorsAreJSONOnStdout` | CutTime Poll/CliGiveUp boundary; pre-admission transport proof | ACTIVE |
|
||||
| `INV-CLI-MINI-EXECUTABLE-001` | Mini records and launches the executable selected by --weed without changing symlink/.. resolution; fresh and legacy runs use an absolute path. | TrialLauncher path wiring, no protocol transition | `cmd/sw-block/mini.go` `miniExecutablePath`, `mini`, `reuseMiniRecord` | `TestMiniWeedSymlinkParentKeepsSelectedExecutable`, `TestMiniRelativeWeedIsRecordedAndPrintedAbsolutely` (`cmd/sw-block`); `TestMiniCleanupFailStopAndSettlement` (`cmd/blockvolume`: failed-start proof rejects watchdog intervention; settled capture completes and live residue refuses cleanup) | NONE (path selection and test ownership only; fresh Linux qualification pending) | STUB |
|
||||
| `INV-CLI-CATALOG-ERROR-001` | The chunk CLI reports filer/master transport failures as retryable remote_unavailable (exit 75), including census, dial, resolve and read failures; configuration refusals stay distinct. An absent v1.1 delete reports snapshot_not_found; its not_found receipt stays unchanged. | M9 client error projection; M4 census refusal, no transition change | `cmd/sw-block/chunk_transport.go` `chunkTransportFailure`; `cmd/sw-block/chunk.go` `chunkResult`; `cmd/sw-block/catalog_snapshot_operation.go` `catalogSnapshotDeleteRefusal`; `core/frontend/chunkstore/single_filer.go` `CheckSingleFiler`; `core/frontend/chunkstore/layout/delete.go` `RunMarkDeleting` | `TestOpsChunkTransportFailureMatrix`, `TestOpsChunkVerifyUnreachableCensusPreservesTransport`, `TestCheckSingleFilerKeepsTransportCause`, `TestSingleFilerConfigurationErrorDeadlineBetweenReads`, `TestCheckSingleFilerSlowDialOrdering`, `TestDialBCatalogKeepsCustomCallerDeadline`, `TestMasterCensusKeepsCustomCallerDeadline`, `TestCheckSingleFilerValidatesAllMasterAddressesBeforeCensus`; `TestOpsChunkCatalogUnavailableIsTyped`, `TestCatalogTransportClassificationKeepsDefiniteAnswers`, `TestSnapshotDeleteAbsentCLIUsesContractCodeAndKeepsReceipt` | SnapOps.Poll | STUB |
|
||||
| `INV-CLI-CHUNK-LOOP-001` | Above the per-request bound, sw-block ops chunk snapshot\|detach repeats the SAME request (same name and request id) only after a retryable or outcome_unknown answer. Manual cut and plain detach use the separate one-POST/read-only-poll contract. | client (no state machine): the CLI side of M5 requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop`; `cmd/sw-block/chunk.go` `chunkPostUntil` | `TestChunkSnapshotRepeatsTimedOutRequestsWithTheSameBody`, `TestChunkSnapshotLoopReusesTheGeneratedRequestID`, `TestChunkLoopRepeatsAnOutcomeUnknownNotMarkedRetryable` (`cmd/sw-block`) | — | ACTIVE |
|
||||
| `INV-CLI-CHUNK-LOOP-002` | Above the per-request bound, sw-block ops chunk snapshot\|detach stops at the first definite answer (success or non-retryable refusal). | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop` | `TestChunkLoopStopsOnANonRetryableRefusal`, `TestChunkDetachOutcomeUnknownSettles` (`cmd/sw-block`) | — | ACTIVE |
|
||||
|
||||
@@ -183,6 +183,9 @@ Restart blockmaster at low write load, including when the cluster spec has not c
|
||||
`install`, not `mv`: with SELinux, a file moved from a home directory keeps its home label and systemd may refuse
|
||||
to run it.
|
||||
|
||||
blockvolume's volume locks are always in `/run/sw-block/locks` under the units. Only `sw-block mini`, a one-user
|
||||
trial, keeps them under its own `--dir`; blockvolume refuses that override under systemd.
|
||||
|
||||
Do **not** enable `sw-blockvolume.service`. It is the single-volume example for the `--topology` setup, which cannot
|
||||
serve a walstore-chunk volume. This manual runs each volume as the template unit `sw-blockvolume@<volume>.service`,
|
||||
which `sw-block volume start` creates (section 3). `sw-blockmaster.service` is enabled in section 2.
|
||||
|
||||
@@ -4,7 +4,10 @@ v1.1.1 is released (2026-12-04).
|
||||
|
||||
v1.1.1 is a fix release of the v1.1 line. None of its changes alters a stored format.
|
||||
|
||||
## Known issue: `sw-block mini` as a non-root user
|
||||
## Known issue: `sw-block mini` as a non-root user (fixed in v1.1.2)
|
||||
|
||||
v1.1.2's `mini` keeps the volume lock under `--dir`, needs no `sudo` to start, prints absolute paths, and names the
|
||||
`--reuse` command after a failed start. With v1.1.1:
|
||||
|
||||
- `blockvolume` keeps one lock per volume under `/run/sw-block/locks`, which a non-root user cannot create. On a
|
||||
fresh host `mini` starts `weed` and `blockmaster`, then stops when `blockvolume` cannot take its lock. Create the
|
||||
|
||||
@@ -500,6 +500,9 @@ sw-block mini --dir ./swb-mini # blockmaster and blockvolume next to sw
|
||||
- If you connected v1, unmount it and run `sudo nvme disconnect -n <nqn>` **before** stopping mini. Otherwise a mounted filesystem sits on a stopped target while the kernel retries for 3 minutes. mini prints this with the connect command and again when it stops.
|
||||
- The data stays in `--dir`; `sw-block mini --dir <dir> --reuse` (printed at stop, quoted for the shell) starts it again, with that run's size, ports, mode and NQN (recorded in `<dir>/mini.json`; a flag that differs is refused).
|
||||
- **It is a trial setup:** one host, loopback, no authentication.
|
||||
- **No root:** blockvolume's volume lock is in `<dir>/locks` (`--volume-lock-dir-test-only`, a hidden override that blockvolume refuses under systemd), so mini starts as any user without the tmpfiles.d entry. Every command it prints names sw-block and weed by their absolute paths.
|
||||
- **Snapshots:** mini runs `v1` with `--chunk-snapshot-schedule off` and prints the command that takes one; the units' daily schedule is not part of a trial.
|
||||
- **A failed start** stops what it started and prints the `--reuse` command that starts again on the same `--dir` (or remove the directory and start fresh).
|
||||
- **Refusals:** it refuses a `--dir` that already exists, unless you pass `--reuse` to start again on it, and refuses a port that is already in use. `--port-shift N` moves every port by N, for a host where a default port is taken.
|
||||
- **Size:** `--size` sets v1's size (default `256MiB`). Volumes above the release maximum are refused by blockmaster as usual.
|
||||
|
||||
|
||||
@@ -83,11 +83,11 @@ cmd/sw-block/main.go runOpsGenerateHelmValues context.WithTimeout 1 per-call NON
|
||||
cmd/sw-block/main.go loadObservationVolume context.WithTimeout 1 per-call NONE: no model row maps this file yet one CLI request (operator --timeout)
|
||||
cmd/sw-block/mini.go miniRun.ready time.Now().Add 1 per-call NONE: no model row maps this file yet mini cluster start wait
|
||||
cmd/sw-block/mini.go miniRun.ready time.After 1 control-timer NONE: no model row maps this file yet start-wait poll
|
||||
cmd/sw-block/mini.go miniRun.resolveLayoutID time.Now().Add 1 per-call NONE: no model row maps this file yet mini cluster resolve wait
|
||||
cmd/sw-block/mini.go miniRun.resolveLayoutID context.WithTimeout 1 per-call NONE: no model row maps this file yet one CLI request (operator --timeout)
|
||||
cmd/sw-block/mini.go miniRun.resolveLayoutID time.After 1 control-timer NONE: no model row maps this file yet resolve-wait poll
|
||||
cmd/sw-block/mini.go miniRun.stop time.After 1 per-call NONE: no model row maps this file yet mini cluster stop wait
|
||||
cmd/sw-block/mini.go mini time.Now().Add 1 per-call NONE: no model row maps this file yet mini cluster resolve wait
|
||||
cmd/sw-block/mini.go mini context.WithTimeout 1 per-call NONE: no model row maps this file yet one CLI request (operator --timeout)
|
||||
cmd/sw-block/mini.go mini time.After 1 control-timer NONE: no model row maps this file yet resolve-wait poll
|
||||
cmd/sw-block/mini.go mini time.After 2 control-timer NONE: no model row maps this file yet resolve-wait poll
|
||||
cmd/sw-block/mini.go mini time.After 1 control-timer NONE: no model row maps this file yet trial child-health poll
|
||||
cmd/sw-block/shell.go inspectionShell.execute context.WithTimeout 1 per-call NONE: no model row maps this file yet one CLI request (operator --timeout)
|
||||
cmd/sw-block/shell_check.go inspectionShell.check context.WithTimeout 1 per-call NONE: no model row maps this file yet one CLI request (operator --timeout)
|
||||
cmd/sw-block/snapshot_operation.go chunkObserveSnapshot context.WithTimeout 1 per-call SnapOps.Send one CLI request (operator --timeout)
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 50 and column 123.
|
Reference in new issue
Block a user