XTLS/Xray-core · warning

Cannot start all fake dns pools

Error message

Cannot start all fake dns pools

What it means

After writing all chunks, writePaddingTurnWithBuffer verifies that chunk lengths sum exactly to recordLength. defaultPaddingChunks and prefix-trimmed variants satisfy this by construction, so a mismatch indicates an internal arithmetic bug (e.g. a fork altering chunk generation or trimming) rather than a runtime condition. The turn has already been fully written to the wire when this fires.

Source

Thrown at app/dns/fakedns/fake.go:192

func (h *HolderMulti) GetDomainFromFakeDNS(ip net.Address) string {
	for _, v := range h.holders {
		if domain := v.GetDomainFromFakeDNS(ip); domain != "" {
			return domain
		}
	}
	return ""
}

func (h *HolderMulti) Type() interface{} {
	return (*dns.FakeDNSEngine)(nil)
}

func (h *HolderMulti) Start() error {
	for _, v := range h.holders {
		if v.config != nil && v.config.IpPool != "" && v.config.LruSize != 0 {
			if err := v.Start(); err != nil {
				return errors.New("Cannot start all fake dns pools").Base(err)
			}
		} else {
			return errors.New("invalid fakeDNS setting")
		}
	}
	return nil
}

func (h *HolderMulti) Close() error {
	var errs []error
	for _, v := range h.holders {
		errs = append(errs, v.Close())
	}
	return errors.Combine(errs...)
}

func (h *HolderMulti) createHolderGroups() error {
	for _, v := range h.config.Pools {

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Diff local changes against upstream for defaultPaddingChunks, trimPaddingPrefix, and the chunk loop
  2. Add a unit test asserting sum(chunks) == targetLength - prefixLength for all schedule fixtures
  3. Revert experimental chunking changes
Defensive patterns

Strategy: try-catch

Validate before calling

func chunksSumToRecord(chunks []int, target, prefix int) bool {
    sum := 0
    for _, c := range chunks {
        sum += c
    }
    return sum == target-prefix
}

Try / catch

if err != nil && strings.Contains(err.Error(), "padding chunks total") {
    // internal invariant break: connection already emitted wrong bytes; drop it and report a bug
}

Prevention

When it happens

Trigger: Modified trimPaddingPrefix/defaultPaddingChunks logic that drops or adds bytes; a variant whose delays length differs from chunks does not cause this (delays are orthogonal), but any change that mutates chunk lengths after computation can.

Common situations: Local patches to the chunk-splitting or prefix-trimming helpers; none in unmodified code.

Related errors


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