{"record":{"id":"e8445b0bd2b3baaf","repo":"seaweedfs/seaweedfs","slug":"master-process-can-not-start-child-process-s","errorCode":null,"errorMessage":"master process can not start child process: %s","messagePattern":"master process can not start child process: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"weed/command/fuse_std.go","lineNumber":322,"sourceCode":"\t\targ0, err := os.Executable()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// pass our PID to the child process\n\t\tpid := os.Getpid()\n\t\targv := append(os.Args, \"-o\", \"child=\"+strconv.Itoa(pid))\n\n\t\tc := make(chan os.Signal, 1)\n\t\tsignal.Notify(c, syscall.SIGTERM)\n\n\t\tattr := os.ProcAttr{}\n\t\tattr.Env = os.Environ()\n\n\t\tchild, err := os.StartProcess(arg0, argv, &attr)\n\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"master process can not start child process: %s\", err))\n\t\t}\n\n\t\terr = child.Release()\n\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"master process can not release child process: %s\", err))\n\t\t}\n\n\t\tselect {\n\t\tcase <-c:\n\t\t\treturn true\n\t\t}\n\t}\n\n\tif fusermountPath != \"\" {\n\t\tif err := os.Setenv(\"PATH\", fusermountPath); err != nil {\n\t\t\tpanic(fmt.Errorf(\"setenv: %s\", err))\n\t\t}","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/seaweedfs/seaweedfs/blob/1c926e8fac8e8001ce25efa1027c90b02b4a1804/weed/command/fuse_std.go#L304-L340","documentation":"runFuse in weed/command/fuse_std.go parses FUSE helper-style options (space/dash/comma separated name=value pairs, e.g. `weed fuse /mnt/sw -o filer=localhost:8888,readOnly=true`) before daemonizing into a master/child pair and calling runMount. In master mode the helper resolves its own executable with os.Executable() and re-execs it as a child with `-o child=<pid>` appended; this panic means os.StartProcess failed, i.e. the weed binary could not be exec'd again. Typical errno causes: ENOENT (binary deleted or renamed over after start), EACCES (exec bit lost, or binary sits on a noexec mount), EAGAIN (RLIMIT_NPROC or cgroup pids.max exhausted), ETXTBSY (binary being rewritten concurrently), plus SELinux/apparmor/seccomp denials.","triggerScenarios":"Package upgrade renames a new weed binary over the running path before the re-exec; container with pids.max nearly exhausted; weed placed on a noexec filesystem or with chmod -x; hardened seccomp profile blocking fork/exec in CI.","commonSituations":"CI containers with tight pid limits; deployment scripts that mv/rm the binary then start mounts from the old path; security-hardened hosts denying exec of non-standard paths.","solutions":["Confirm the binary resolves and is executable: ls -l $(command -v weed) and test -x","Invoke weed via a stable absolute path from a location that is not rewritten during deploys","Raise process limits (ulimit -u, cgroup pids.max) if fork fails with 'resource temporarily unavailable'","Check for noexec mount flags and SELinux/apparmor denials on the binary path","Bypass the re-exec entirely with `weed mount -dir=... -filer=...`, which mounts directly"],"exampleFix":"// before\n/tmp/deploy-old/weed fuse /mnt/sw -o filer=localhost:8888   # binary path replaced/deleted at deploy time\n\n// after\n/opt/seaweedfs/bin/weed fuse /mnt/sw -o filer=localhost:8888 # stable absolute path, exec bit intact","handlingStrategy":"validation","validationCode":"# bash: verify the helper can re-exec itself before mounting\nexe=\"$(command -v weed)\"\n[ -n \"$exe\" ] && [ -x \"$exe\" ] || { echo \"weed binary not executable: $exe\" >&2; exit 1; }\nreadlink -f \"$exe\" >/dev/null || exit 1","typeGuard":"func canReexecSelf() error {\n\texe, err := os.Executable()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfi, err := os.Stat(exe)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot stat %s: %w\", exe, err)\n\t}\n\tif fi.IsDir() || fi.Mode()&0o111 == 0 {\n\t\treturn fmt.Errorf(\"%s is not executable\", exe)\n\t}\n\treturn nil\n}","tryCatchPattern":null,"preventionTips":["Deploy weed to a versioned absolute path and symlink a stable name to it","Never chmod -x or delete the running binary's path during upgrades","Size container pids.max above the helper's master+child pair","Prefer `weed mount` for environments where re-exec is restricted"],"tags":["fuse","mount","process","exec","daemonization","environment"],"backgroundTag":null,"analyzedSha":"1c926e8fac8e8001ce25efa1027c90b02b4a1804","analyzedAt":"2026-08-15T15:37:02.018Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}