juicedata/juicefs · error
no valid pprof port found
Error message
no valid pprof port found
What it means
getPprofPort scans every LISTEN line from lsof for the mount process, keeping only ports in the pprof range 6060-6099 that pass checkPort (the /debug/pprof/cmdline endpoint must be alive and its cmdline must contain the mount point). If no port survives, listenPort stays -1 and the function returns this error, meaning `juicefs debug` cannot locate the running client's pprof endpoint.
Source
Thrown at cmd/debug.go:217
if err != nil {
logger.Errorf("failed to parse port %v: %v", port, err)
}
return
}()
if err != nil {
continue
}
if port >= 6060 && port <= 6099 && port > listenPort {
if err := checkPort(port, amp); err == nil {
listenPort = port
}
continue
}
}
}
if listenPort == -1 {
return 0, fmt.Errorf("no valid pprof port found")
}
return listenPort, nil
}
func getRequest(url string, timeout time.Duration) ([]byte, error) {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
if err != nil {
return nil, fmt.Errorf("error creating GET request: %v", err)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
return nil, fmt.Errorf("error GET request: %v", err)
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("error GET request, status code %d", resp.StatusCode)
}View on GitHub (pinned to c9a67b23e8)
Solutions
- Confirm the mount process actually listens on pprof: `lsof -i -nP -p <pid> | grep LISTEN` and look for 6060-6099.
- Run `curl http://localhost:6060/debug/pprof/cmdline?debug=1` and verify the output contains the exact mount point string passed to `juicefs debug` (checkPort requires an exact field match).
- Run `juicefs debug` in the same network namespace/container as the mount process (e.g. `nsenter` or `docker exec`).
- Re-mount with pprof enabled (default behavior; check that the binary is not built/launched with pprof disabled) or set `--debug-agent` in the config so cfg.Port.DebugAgent supplies the port directly.
- If lsof requires elevated privileges, re-run with sudo so LISTEN lines are not filtered out.
Example fix
// before (mount without pprof reachable) juicefs mount redis://host:6379/1 /mnt/jfs // after (verify/enable pprof, then debug) curl -s http://localhost:6060/debug/pprof/cmdline?debug=1 | tr '\0' ' ' # must contain /mnt/jfs juicefs debug /mnt/jfs
Defensive patterns
Strategy: fallback
Validate before calling
out, _ := exec.Command("/bin/sh", "-c", fmt.Sprintf("lsof -i -nP -p %d | grep LISTEN", pid)).CombinedOutput()
re := regexp.MustCompile(`:(60[6-9]\d)\s`) // 6060-6099
if !re.Match(out) {
return errors.New("no pprof listener in 6060-6099 for this pid; is pprof enabled?")
} Type guard
func hasPprofPort(listenPorts []int) bool {
for _, p := range listenPorts {
if p >= 6060 && p <= 6099 { return true }
}
return false
} Try / catch
if port, err := getPprofPort(pid, amp); err != nil {
logger.Warnf("pprof collection skipped: %v", err) // degrade gracefully, continue debug collection
return nil
} Prevention
- Mount with pprof enabled (default) and don't occupy 6060-6099 with other services.
- Run `juicefs debug` in the same host/network namespace/container as the mount process.
- Pre-verify with `curl http://localhost:6060/debug/pprof/cmdline?debug=1` before running debug.
- Ensure lsof is installed and run with sufficient privileges so LISTEN lines aren't filtered.
When it happens
Trigger: Called by collectPprof when: the JuiceFS client was built/started without net/http/pprof listening (no 6060 port); pprof binds outside 6060-6099; all candidate ports fail checkPort (mount-point mismatch in cmdline, pprof unreachable); or the lsof output was empty/unparseable.
Common situations: Mounting with `--no-pprof`-style restrictions or a firewalled/loopback-restricted pprof; the process is running in a different network namespace or container than where `juicefs debug` is run; `--debug-agent` config sets an out-of-range port; stale lsof (root privileges missing so lines are filtered).
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/2325694a08ac7b89.
Report an issue: GitHub.