XTLS/Xray-core · warning

empty process path

Error message

empty process path

What it means

darwinProcessPath called proc_pidpath successfully (no syscall error) but it returned a byte count <= 0, i.e. an empty path. This happens when the kernel can see the process but returns no path bytes, for example zombie processes or processes whose image is being torn down.

Source

Thrown at common/net/find_process_darwin.go:296

		if value != 0 {
			return false
		}
	}
	return true
}

func darwinReadNativeUint32(b []byte) uint32 {
	return *(*uint32)(unsafe.Pointer(&b[0]))
}

func darwinProcessPath(pid int32) (string, error) {
	buf := make([]byte, unix.PathMax)
	n, err := darwinProcPIDPath(pid, buf)
	if err != nil {
		return "", err
	}
	if n <= 0 {
		return "", errors.New("empty process path")
	}
	return strings.TrimRight(string(buf[:n]), "\x00"), nil
}

func darwinProcPIDInfo(pid int32, flavor int, arg uint64, buf []byte) (int, error) {
	var ptr unsafe.Pointer
	if len(buf) > 0 {
		ptr = unsafe.Pointer(&buf[0])
	}

	r0, _, errno := syscall_syscall6(libc_proc_pidinfo_trampoline_addr, uintptr(pid), uintptr(flavor), uintptr(arg), uintptr(ptr), uintptr(len(buf)), 0)
	if errno != 0 {
		return 0, errno
	}
	return int(r0), nil
}

func darwinProcPIDFDInfo(pid int32, fd int32, flavor int, buf []byte) (int, error) {

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Treat as a transient lookup miss: skip process-based rules for this connection
  2. Retry the lookup once after a short delay if the connection persists
  3. Verify with ps -o stat= -p <pid>: a Z status confirms a zombie
  4. Reap children promptly in the application that spawns them
Defensive patterns

Strategy: fallback

Type guard

func isEmptyProcessPath(err error) bool {
    return err != nil && strings.Contains(err.Error(), "empty process path")
}

Try / catch

if err != nil && isEmptyProcessPath(err) {
    // zombie or tearing-down process; skip process rules for this connection
}

Prevention

When it happens

Trigger: PID exists in the process table but is a zombie (exited, not yet reaped), so proc_pidpath yields 0 bytes; or a process mid-exec where the path is transiently unavailable.

Common situations: High-churn process environments (build systems, CGI-like spawners) where children become zombies between enumeration and path query.

Related errors


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/42f020882f8978dd. Report an issue: GitHub.