juicedata/juicefs · error

pprof will be collected, but no listen port

Error message

pprof will be collected, but no listen port

What it means

After running lsof successfully, `getPprofPort` looks for a listening port in the pprof range 6060-6099; if the lsof output yields no usable port it reports "pprof will be collected, but no listen port". It means the target JuiceFS process is not serving its pprof debug agent. (If lines exist but no candidate passes parsing/checkPort, the related "no valid pprof port found" is returned at line 217.)

Source

Thrown at cmd/debug.go:184

			} else {
				return port, nil
			}
		}
	}

	var lsofArgs []string
	if requireRootPrivileges {
		lsofArgs = append(lsofArgs, "sudo")
	}
	lsofArgs = append(lsofArgs, "/bin/sh", "-c", "lsof -i -nP | grep -v grep | grep LISTEN | grep "+pid)
	ret, err := exec.Command(lsofArgs[0], lsofArgs[1:]...).CombinedOutput()
	if err != nil {
		return 0, fmt.Errorf("failed to execute command `%s`: %v", strings.Join(lsofArgs, " "), err)
	}
	logger.Debugf("lsof output: \n%s", string(ret))
	lines := strings.Split(string(ret), "\n")
	if len(lines) == 0 {
		return 0, fmt.Errorf("pprof will be collected, but no listen port")
	}

	var listenPort = -1
	for _, line := range lines {
		fields := strings.Fields(line)
		if len(fields) != 0 {
			port, err := func() (port int, err error) {
				defer func() {
					e := recover()
					if e != nil {
						err = fmt.Errorf("failed to parse listen port: %v", e)
					}
				}()
				port, err = strconv.Atoi(strings.Split(fields[len(fields)-2], ":")[1])
				if err != nil {
					logger.Errorf("failed to parse port %v: %v", port, err)
				}
				return

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Restart the mount with the pprof debug agent enabled so it listens on 6060-6099.
  2. Configure the DebugAgent address in the mount config (Port.DebugAgent) so lsof discovery is skipped.
  3. Manually verify with `curl http://127.0.0.1:6060/debug/pprof/` on the host where the process runs and collect profiles there.
  4. Free or correct the 6060-6099 port range if another service occupies it, then retry.

Example fix

// before
juicefs debug /mnt/jfs   # pprof will be collected, but no listen port
// after: restart mount so pprof listens
juicefs mount sqlite3://test.db /mnt/jfs --debug-agent 127.0.0.1:6060
juicefs debug /mnt/jfs
Defensive patterns

Strategy: validation

Validate before calling

curl -fsS http://127.0.0.1:6060/debug/pprof/ >/dev/null 2>&1 \
  && juicefs debug /mnt/jfs \
  || echo "pprof agent not reachable; enable debug agent on the mount"

Try / catch

if err := runDebug(); err != nil {
    if strings.Contains(err.Error(), "listen port") {
        log.Printf("pprof agent not enabled on target; restart mount with debug agent")
    }
}

Prevention

When it happens

Trigger: Running `juicefs debug <mnt>` against a process whose config lacks a debug-agent port and whose lsof output contains no LISTEN line on ports 6060-6099, or `checkPort` rejects all candidate ports.

Common situations: Mount was started without the pprof/debug agent enabled; the mount is behind container/network isolation so the port isn't visible; another process squats the 6060-6099 range and checkPort fails.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/a5902fedc6d741db. Report an issue: GitHub.