juicedata/juicefs · error

get local ip: %s

Error message

get local ip: %s

What it means

When config.ManagerAddr is set and looks local (starts with ':' or contains '0.0.0.0'), startManager resolves the machine's outbound IP by dialing the first worker on port 22 via utils.GetLocalIp. This error wraps a failure of that resolution, so the manager cannot advertise a reachable address to workers.

Source

Thrown at pkg/sync/cluster.go:329

			}
			for _, key := range r.FailedKeys {
				checkpointMgr.MarkFailed(key)
			}
		}
		logger.Debugf("receive stats %+v from %s", r, req.RemoteAddr)
		_, _ = w.Write([]byte("OK"))
	})
	var addr string
	u, err := url.Parse("ssh://" + config.Workers[0])
	if err != nil {
		return "", fmt.Errorf("invalid worker address %s: %s", config.Workers[0], err)
	}
	if config.ManagerAddr != "" {
		addr = config.ManagerAddr
		if strings.HasPrefix(addr, ":") || strings.Contains(addr, "0.0.0.0") {
			ip, err := utils.GetLocalIp(net.JoinHostPort(u.Host, "22"))
			if err != nil {
				return "", fmt.Errorf("get local ip: %s", err)
			}
			addr = ip + addr
		}
	} else {
		ip, err := utils.GetLocalIp(net.JoinHostPort(u.Host, "22"))
		if err != nil {
			return "", fmt.Errorf("not found local ip: %s", err)
		}
		logger.Debugf("Use local ip %s", ip)
		addr = ip
	}

	if !strings.Contains(addr, ":") {
		addr += ":"
	}

	l, err := net.Listen("tcp", addr)
	if err != nil {

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Set --manager-addr to a fully explicit reachable address (e.g. "192.168.1.10:8080") instead of ":8080" so IP resolution is skipped
  2. Verify the worker host is resolvable (DNS/hosts entry) and reachable on port 22 from the manager machine
  3. Check that the machine has a non-loopback network interface with a route to the workers

Example fix

// before
--manager-addr :8080
// after
--manager-addr 192.168.1.10:8080
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the manager address is explicit and routable
if strings.HasPrefix(managerAddr, ":") || strings.Contains(managerAddr, "0.0.0.0") {
	ip, err := utils.GetLocalIp(workerHost + ":22")
	if err != nil {
		// resolve/choose a concrete IP beforehand
	}
}

Prevention

When it happens

Trigger: startManager runs with ManagerAddr like ":8080" or "0.0.0.0:8080" and utils.GetLocalIp("workerhost:22") fails — no route to the worker on port 22, DNS failure for the worker hostname, or no non-loopback interface available.

Common situations: Firewall blocks outbound port 22 to workers; worker hostname not resolvable from the manager; running in a container/network namespace without a routable interface; typo in worker address making the dial target unreachable.

Related errors


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