fix: eliminate CI test lifecycle leaks and metric flakiness - #27480
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Follow-up on the failed coverage check:
Linux/arm64 reproduction with |
|
Scope correction completed in f12d818: the four native/CGo link-contract files were restored to the PR base. #27480 now contains only the lifecycle leak and hardware-metric test fixes, so matrixorigin/CI#429 is no longer required for this PR. The earlier loader failure was caused by the bundled native-link change, not by the lifecycle fixes. |
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #27452
Fixes #27412
Fixes #27408
What this PR does / why we need it:
This fixes the underlying lifecycle and measurement contracts behind the two CI failures instead of reducing coverage scope, weakening assertions, or rerunning deterministic failures.
Coverage OOM root cause
Heap profiling of the exact 462-package coverage shape showed that repeated
MockCompilerContext.GetProcesscalls created freshProcessinstances. EachProcessthen replaced the service runtime'sAutoIncrementService. The displaced services retained background workers and caches, so the plan test process grew to about 12 GiB and was killed by the 14 GiB runner cgroup.Processfor each mock compiler context, matching the compiler-session contract.testutil.SetupAutoIncrServiceconcurrency-safe and idempotent per service runtime.The same full
pkg/sql/plansuite with the CI 462-packagecoverpkglist passes with peak RSS reduced from 12,537,728 KiB to 269,880 KiB (97.85%). Coverage scope and test parallelism are unchanged.Hardware CPU test root cause
The old assertion compared a cumulative busy-seconds delta with
cpu.Percentsampled over a different time window. Those values are not mathematically comparable under changing runner load.The test now validates each metric's actual contract independently: percentage is bounded to
[0, 100], the cumulative counter is non-negative, and the counter is monotonic. The unnecessary one-second sleep is removed.Scope decision
Native/CGo dependency-closure hardening is independent of these lifecycle and metric fixes. It has been removed from this PR so the change remains reviewable and continues to use the current
mainCI link contract. Any native-link hardening should be reviewed separately with its matching MatrixOne and CI changes.Validation
coverpkgfullpkg/sql/plansuite.-race -count=100.pkg/sql/plan,pkg/testutil, andpkg/util/metricsuites with-race.go buildandgo vetfor all modified Go packages.git diff --checkand explicit verification that the four native/CI files match the PR base.