XTLS/Xray-core · error

failed to close all resources

Error message

failed to close all resources

What it means

Returned by tcpWorker.Close when one or more of the worker's owned resources (the hub and the proxy handler) failed to close; individual close errors are concatenated into the base error so no failure is silently dropped during inbound worker shutdown.

Solutions

  1. Inspect the concatenated inner errors
  2. Generally ignorable during shutdown unless it recurs
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at app/proxyman/inbound/worker.go:162 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at app/proxyman/inbound/worker.go:162

	if err != nil {
		return errors.New("failed to listen TCP on ", w.port).AtWarning().Base(err)
	}
	w.hub = hub
	return nil
}

func (w *tcpWorker) Close() error {
	var errs []interface{}
	if w.hub != nil {
		if err := common.Close(w.hub); err != nil {
			errs = append(errs, err)
		}
		if err := common.Close(w.proxy); err != nil {
			errs = append(errs, err)
		}
	}
	if len(errs) > 0 {
		return errors.New("failed to close all resources").Base(errors.New(serial.Concat(errs...)))
	}

	return nil
}

func (w *tcpWorker) Port() net.Port {
	return w.port
}

type udpConn struct {
	lastActivityTime int64 // in seconds
	reader           buf.Reader
	writer           buf.Writer
	output           func([]byte) (int, error)
	remote           net.Addr
	local            net.Addr
	done             *done.Instance
	uplink           stats.Counter

View on GitHub (pinned to 7d214f8b09)