Skip to content

[Bug]: TestSessionCloseRetainsCleanupWhenRetainedCapIsFull races cleanup ownership transfer #26279

Closed

Description

@ck89119

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

ad4cd9da05d0a85829d359cc4ccd3bac90016154

Other Environment Information

  • Hardware parameters: GitHub Actions Ubuntu/x86 runner; also reproduced on
    local macOS/arm64
  • OS type: Ubuntu/x86 in CI, macOS/arm64 locally
  • Others: Go 1.26.4

Actual Behavior

TestSessionCloseRetainsCleanupWhenRetainedCapIsFull intermittently fails at
pkg/sql/plan/function/func_unary_test.go:9509:

Error: Should be true
Test:  TestSessionCloseRetainsCleanupWhenRetainedCapIsFull

The preceding log shows that cleanup ownership was successfully transferred:

ReleaseUserLevelLocksOnSessionClose transferred cleanup ownership after release failure

The test only checks userLevelLocks.retainedCloseCleanups[owner]. The
asynchronous retained cleanup worker can transfer the request to detached
cleanup before that assertion, so the assertion observes false even though
cleanup ownership has not been lost.

This failed in PR #26258 CI at merge head
bf402a5103f04c48f27faa3b2706e49ddaeb8cb2. The relevant production and test
files are identical between that merge head and its main parent
ad4cd9da05d0a85829d359cc4ccd3bac90016154, so the failure is unrelated to the
PR diff.

Expected Behavior

The test should assert durable cleanup ownership regardless of whether the
request is currently retained in retainedCloseCleanups or has already been
transferred to detached cleanup. Repeated package tests should pass
deterministically.

Steps to Reproduce

.agents/skills/mo-dev/scripts/mo-cgo-test \
  -count=30 \
  -timeout=300s \
  -run '^TestSessionCloseRetainsCleanupWhenRetainedCapIsFull$' \
  ./pkg/sql/plan/function

On the exact CI merge head, the command reproduced the same failure locally.

Additional information

Activity

  1. self-assigned this
    on Jul 28, 2026
  2. added
    kind/bug
    on Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions