JuliusBrussee/caveman · error

cachebench: replay gap overflow

Error message

cachebench: replay gap overflow

What it means

Error "cachebench: replay gap overflow" thrown in JuliusBrussee/caveman.

Source

Thrown at cacheengine/cachebench/replay.go:789

		TimingBasis: record.TimingBasis, TokenBasis: record.TokenBasis, TimeScale: scale,
		TimingFaithful: record.TimingBasis == TimingGrounded && scale == 1 && drift <= tolerance,
		ScheduledAt:    scheduled.Format(time.RFC3339Nano), ScheduleDriftMilliseconds: drift.Milliseconds(),
		ScheduleToleranceMilliseconds: tolerance.Milliseconds(),
		StartedAt:                     started.Format(time.RFC3339Nano), Applied: optimized.Applied,
		Decision: optimized.Decision, Reason: optimized.Reason, Attribution: optimized.Profile.Attribution,
		OptimizerIDs: append([]string(nil), optimized.OptimizerIDs...),
	}
}

func scaledReplayGap(gap time.Duration, scale float64) (time.Duration, error) {
	if gap < 0 || scale <= 0 || math.IsNaN(scale) || math.IsInf(scale, 0) {
		return 0, errors.New("cachebench: invalid replay gap")
	}
	if gap == 0 {
		return 0, nil
	}
	if scale > float64(math.MaxInt64)/float64(gap) {
		return 0, errors.New("cachebench: replay gap overflow")
	}
	return time.Duration(float64(gap) * scale), nil
}

func sleepContext(ctx context.Context, delay time.Duration) error {
	if delay <= 0 {
		return nil
	}
	timer := time.NewTimer(delay)
	defer timer.Stop()
	select {
	case <-ctx.Done():
		return ctx.Err()
	case <-timer.C:
		return nil
	}
}

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Reduce replay gaps so cumulative values do not overflow.

When it happens

Trigger: Thrown at cacheengine/cachebench/replay.go:789 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/61a6766b016f5d38. Report an issue: GitHub.