{"record":{"id":"400655358efe93cc","repo":"juanfont/headscale","slug":"test-failed-d-w","errorCode":null,"errorMessage":"test failed: %d %w","messagePattern":"test failed: (.+?) %w","errorType":"exception","errorClass":"ErrMemoryLimitViolations","httpStatus":null,"severity":"error","filePath":"cmd/hi/docker.go","lineNumber":162,"sourceCode":"\t\tlog.Printf(\"Warning: failed to extract artifacts from containers: %v\", err)\n\t}\n\n\t// Always list control files regardless of test outcome\n\tlistControlFiles(logsDir)\n\n\t// Print stats summary and check memory limits if enabled\n\tif config.Stats && statsCollector != nil {\n\t\tviolations := statsCollector.PrintSummaryAndCheckLimits(config.HSMemoryLimit, config.TSMemoryLimit)\n\t\tif len(violations) > 0 {\n\t\t\tlog.Printf(\"MEMORY LIMIT VIOLATIONS DETECTED:\")\n\t\t\tlog.Printf(\"=================================\")\n\n\t\t\tfor _, violation := range violations {\n\t\t\t\tlog.Printf(\"Container %s exceeded memory limit: %.1f MB > %.1f MB\",\n\t\t\t\t\tviolation.ContainerName, violation.MaxMemoryMB, violation.LimitMB)\n\t\t\t}\n\n\t\t\treturn fmt.Errorf(\"test failed: %d %w\", len(violations), ErrMemoryLimitViolations)\n\t\t}\n\t}\n\n\tshouldCleanup := config.CleanAfter && (!config.KeepOnFailure || exitCode == 0)\n\tif shouldCleanup {\n\t\tif config.Verbose {\n\t\t\tlog.Printf(\"Running post-test cleanup for run %s...\", runID)\n\t\t}\n\n\t\tcleanErr := cleanupAfterTest(ctx, cli, resp.ID, runID)\n\n\t\tif cleanErr != nil && config.Verbose {\n\t\t\tlog.Printf(\"Warning: post-test cleanup failed: %v\", cleanErr)\n\t\t}\n\n\t\t// Clean up artifacts from successful tests to save disk space in CI\n\t\tif exitCode == 0 {\n\t\t\tif config.Verbose {","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/hi/docker.go#L144-L180","documentation":"Returned after a test run completes when stats collection is enabled and one or more monitored containers exceeded their configured memory limits. It wraps the `ErrMemoryLimitViolations` sentinel ('container(s) exceeded memory limits') and prefixes the violation count, so `errors.Is(err, ErrMemoryLimitViolations)` matches. This is a test-quality gate, not an infrastructure failure: the test itself may have passed.","triggerScenarios":"Running `hi run` with `--stats` (config.Stats true) plus HSMemoryLimit/TSMemoryLimit, where `statsCollector.PrintSummaryAndCheckLimits` finds max recorded memory above a limit for the headscale or tailscale containers.","commonSituations":"Introducing a memory leak or enlarged NodeStore snapshot in hscontrol; lowering the configured limit below real usage; noisy neighbor inflating container memory during parallel runs.","solutions":["Look at the printed summary table to see which container (hs vs ts) and by how much it exceeded.","Profile the offending component — for headscale, capture a heap profile of the test run and look at mapper/state allocations.","If the limit was set unrealistically low, raise HSMemoryLimit/TSMemoryLimit in the run config.","Re-run to rule out measurement noise from parallel Docker activity."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before gating on it, sanity-check the limits are plausible vs the image floor\nif config.HSMemoryLimit < 100 { // MB; headscale needs more than this\n    return fmt.Errorf(\"HSMemoryLimit %v is below plausible usage\", config.HSMemoryLimit)\n}","typeGuard":null,"tryCatchPattern":"if err := runDockerTest(ctx, config); err != nil {\n    if errors.Is(err, ErrMemoryLimitViolations) {\n        // treat as a performance regression: profile headscale heap,\n        // do not retry — the run already completed and measured\n    }\n}","preventionTips":["Run with --stats in CI continuously so regressions are caught at the introducing commit.","Keep limit values realistic relative to measured baselines.","Record baseline max-memory per test in the repo so limit changes are deliberate."],"tags":["memory","resource-limits","stats","hi-runner","performance"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}