Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
#26214 and #26243 cover the same allocation-count test failing under race instrumentation. They were closed after the allocation-only test was moved behind //go:build !race. No open issue records the failure under non-race coverage instrumentation.
Branch Name
main (observed on PR #26532 after merging main)
Commit ID
5e5748f96620f28ead0b1084042e440288a2c5dc
Other Environment Information
- Hardware parameters: GitHub-hosted Ubuntu/x86 runner
- OS type: Linux/x86
- Go version: 1.26.4
- Workflow: MatrixOne ALL CI
- Job: Matrixone UT Coverage / UT Coverage on Ubuntu/x86
Actual Behavior
The non-race coverage UT failed in pkg/sql/plan/function:
=== RUN TestJSONOverlapsAccessorAllocationsDoNotScaleWithRows
func_builtin_json_overlap_alloc_test.go:65:
Error: "22" is not less than or equal to "10"
Messages: accessor allocations must be batch-scoped: one=0.000000 many=22.000000
--- FAIL: TestJSONOverlapsAccessorAllocationsDoNotScaleWithRows (0.01s)
The coverage job runs the suite with repository-wide coverage instrumentation:
go test -mod=readonly -json -short -v -tags matrixone_test -p 6 \
-covermode=set -coverprofile=<profile> -coverpkg=<all packages> ./...
The failed UT coverage producer then caused Matrixone Utils CI / Coverage to fail with:
coverage merge skipped because at least one required producer was skipped or failed
This dequeued PR #26532 from the merge queue.
Analysis
The failure is outside the PR change scope
PR #26532 changes only:
pkg/fileservice/object_storage_semaphore.gopkg/fileservice/object_storage_semaphore_test.go
It does not change pkg/sql/plan/function, jsonOverlaps, or the failing allocation test.
The same workflow head passed:
- Ubuntu/x86 ordinary UT
- Linux/arm64 SCA
- standalone pessimistic BVT
- compose proxy BVT
The ordinary race UT does not execute this allocation-only test because the file has //go:build !race; the relevant evidence is the coverage history below.
The failure is intermittent
An earlier UT coverage run on PR head f7038e9f03d1c9733b90000e2926205f9cf000be passed:
Between that head and the failing head 5e5748f96620f28ead0b1084042e440288a2c5dc, no file in pkg/sql/plan/function changed. The intervening main merges removed the stream feature and changed TAE transfer-page synchronization; neither changes JSON_OVERLAPS or this test.
The same test therefore passed and failed across heads with unchanged target code. This strongly indicates an instrumentation/runtime-sensitive test rather than a regression introduced by PR #26532.
Why the existing race-only fix is insufficient
The test uses:
testing.AllocsPerRun(3, func() {
result.PreExtendAndReset(rows)
jsonOverlaps(...)
})It compares the complete execution for one row with 8192 rows and requires:
manyRows <= oneRow + 10
#26214 and #26243 already established that this exact style of allocation assertion is unstable under race instrumentation. Moving it to a !race file prevents race UT failures, but the test still runs under repository-wide -coverpkg instrumentation.
In the failing run, the one-row measurement was 0 while the longer 8192-row measurement observed 22 allocations. testing.AllocsPerRun derives its result from runtime allocation counters around the measured callback. A longer, fully instrumented execution can pick up initialization, cache, instrumentation, or background-runtime allocations outside the narrow accessor-lifetime invariant. This is the likely mechanism; the log proves the unstable count but does not identify which individual allocations contributed to the 22.
Impact
- Unrelated PRs can fail a required coverage producer.
- The downstream coverage merge fails even though it has no independent coverage error.
- Mergify removes otherwise-green PRs from the merge queue.
- Rerunning may pass without any code change, wasting CI capacity and reviewer time.
Expected Behavior
An allocation-statistics-only regression test should not intermittently fail unrelated PRs because of coverage/runtime instrumentation.
JSON_OVERLAPS functional behavior should remain tested in ordinary, race, and coverage builds. The accessor-allocation invariant should be measured in an isolated/stable environment or asserted without relying on a small exact process-wide allocation delta during an 8192-row instrumented execution.
Steps to Reproduce
- Check out commit
5e5748f96620f28ead0b1084042e440288a2c5dc. - Use the MatrixOne CGo test environment.
- Run the non-race UT coverage workflow with
-covermode=setand repository-wide-coverpkg. - Observe
TestJSONOverlapsAccessorAllocationsDoNotScaleWithRows. - Repeat the coverage run. The test may pass or report batch allocations above the
oneRow + 10threshold without any JSON_OVERLAPS source change.
Suggested Fix Direction
Keep the functional JSON_OVERLAPS tests in every build, but make the allocation regression deterministic. Possible directions:
- Run the allocation-only assertion in a dedicated non-race, non-coverage test job/process with a narrowly controlled package scope.
- Redesign the test to measure the specific accessor construction/ownership invariant instead of the complete 8192-row function execution.
- If exact allocation counting remains necessary, isolate warm-up and measured state so lazy initialization and unrelated runtime work cannot be charged only to the large-row measurement.
- Add repeated validation under the actual coverage command before considering the issue fixed.
Simply increasing the threshold would reduce sensitivity but would weaken the intended batch-scoped allocation regression guarantee.
Additional information
- Failing PR: fix(fileservice): honor context while waiting for object storage slots #26532
- Workflow run: https://github.com/matrixorigin/matrixone/actions/runs/30659556210
- Failing UT coverage job: https://github.com/matrixorigin/matrixone/actions/runs/30659556210/job/91252374839
- Dependent coverage merge failure: https://github.com/matrixorigin/matrixone/actions/runs/30659556210/job/91259474214
- Earlier passing coverage job: https://github.com/matrixorigin/matrixone/actions/runs/30651042748/job/91224172294
- Test source:
pkg/sql/plan/function/func_builtin_json_overlap_alloc_test.go - Related race-only reports: [Bug]: JSON_OVERLAPS allocation test flakes under race instrumentation #26214, [Bug]: JSON_OVERLAPS allocation regression test is flaky under -race #26243
Activity
fix: harden async lifecycle and CI test contracts (#26546)
fix: harden async lifecycle and CI test contracts (matrixorigin#26546)
fix: harden async lifecycle and CI test contracts (matrixorigin#26546)
fix: harden async lifecycle and CI test contracts (matrixorigin#26546)