Skip to content

[Bug]: flaky user-level lock cleanup test in coverage UT #26262

Closed

Description

@XuPeng-SH

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

c6d7a1168c5c02e4578359dedaee27dd1dc1950e (base of PR #26250; failing head: c4e8683c2bf3ee7f14ef725064ea10316ddb6ecd)

Other Environment Information

Actual Behavior

Matrixone UT Coverage / UT Coverage on Ubuntu/x86 failed in:

github.com/matrixorigin/matrixone/pkg/sql/plan/function
TestReleaseUserLevelLocksOnSessionCloseRetainsSaturatedHandoffAndRecovers
func_unary_test.go:8684: Should be true

The test calls releaseUserLevelLocksOnSessionCloseWithTimeout with cleanup-handoff admission deliberately saturated, then immediately expects userLevelLocks.retainedCloseCleanups[owner] to remain present. The log confirms the code first took the retained asynchronous-cleanup path:

ReleaseUserLevelLocksOnSessionClose retained cleanup ownership for async retry after release failure

but the expected retained entry was already absent at the assertion. The retained-cleanup worker is started asynchronously by retainUserLevelLockCloseCleanup; it can race the assertion and either hand off/delete the entry or observe cleanup state differently.

Expected Behavior

The test must be deterministic under coverage instrumentation. It should verify the intended lifecycle invariant without relying on a transient global-map state that an asynchronous worker may consume.

Steps to Reproduce

  1. Run the coverage UT workflow on a revision containing fix: add mysql user-level lock functions #25019.
  2. Execute pkg/sql/plan/function tests repeatedly with coverage instrumentation.
  3. Observe occasional failure of TestReleaseUserLevelLocksOnSessionCloseRetainsSaturatedHandoffAndRecovers at the retainedCloseCleanups assertion.

Additional Information

Activity

  1. added
    kind/bug
    on Jul 27, 2026
  2. added theissue type on Jul 27, 2026
  3. added 3 commits that reference this issue on Jul 27, 2026
    f9cd315
    6d8ae48
    7efe365
  4. added 3 commits that reference this issue on Sep 17, 2026
    925bdbe
    d80f673
    6e48619
  5. gouhongshen commented on Nov 11, 2026

    @gouhongshen
    Contributor

    Recurrence record (2026-11-11) — this closed flake recurred on PR #32510, at a later assertion stage than the one recorded here.

    • Workflow/job: MatrixOne ALL CI (pull_request_target), run 42974149196 attempt 1, job Matrixone CI execution / UT Test on Ubuntu/x86 (130369282868), head 71f09a1fc7788b2f33cd51e99ad0c12c2062ac12, failing window 2026-11-11 07:47:59–07:49:10 UTC (package elapsed 71.7s under the full parallel UT suite).
    • Observed failure: pkg/sql/plan/function — TestReleaseUserLevelLocksOnSessionCloseRetainsSaturatedHandoffAndRecovers in func_unary_test.go: --- FAIL after 3.16s, Condition never satisfied at the final require.Eventually (func_unary_test.go:11219) which polls getUserLevelLock(lockName, 0, contender) == 1 for up to 3s after the lock service is unblocked and the saturated detached-cleanup backlog is drained. The WARN lines confirm the intended injection path fired: releaseAllUserLevelLocks unlock failed: ... err=context deadline exceeded and ReleaseUserLevelLocksOnSessionClose retained cleanup ownership for async retry after release failure. Unlike the assertion this issue originally recorded (func_unary_test.go:8684: Should be true racing the transient retainedCloseCleanups entry, since rewritten into durable-ownership require.Eventually assertions), this failure is the 3-second recovery bound expiring while the retained async cleanup worker had not yet made the lock re-acquirable.
    • Why it is unrelated to that PR: PR feat(plan): widen functional index expression eligibility and diagnostics #32510 changes only pkg/sql/plan, pkg/sql/parsers/tree, pkg/tests/sqlintegration, BVT case files and docs; go list -deps github.com/matrixorigin/matrixone/pkg/sql/plan/function contains none of those packages, so the failed test binary contains no file changed by the PR. The same test passed on this branch's two preceding MatrixOne ALL CI runs hours earlier on parent head 3e8c72bbdf (42950463403 and 42960023738, both success).
    • Disposition: failure classified as unrelated flake of this timing-sensitive recovery test; a failed-jobs rerun of run 42974149196 was triggered with no change to the PR.

    The recurrence suggests the retained-cleanup worker's asynchronous retry can still take longer than the 3s bound on a fully loaded UT runner, so this test family (#26255, #26262, #26397) may deserve a load-independent recovery wait or a bounded-retry helper if it keeps flaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug/utkind/bugkind/test-ci

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions