Skip to content

release-25.4: tenantcapabilitieswatcher: fix nil deref removing placeholder entry#169416

Open
stevendanna wants to merge 1 commit intocockroachdb:release-25.4from
stevendanna:blathers/backport-release-25.4-168391
Open

release-25.4: tenantcapabilitieswatcher: fix nil deref removing placeholder entry#169416
stevendanna wants to merge 1 commit intocockroachdb:release-25.4from
stevendanna:blathers/backport-release-25.4-168391

Conversation

@stevendanna
Copy link
Copy Markdown
Collaborator

Backport 1/1 commits from #168391 on behalf of @stevendanna.


The Watcher's getInternal method inserts a placeholder watcherEntry
with a nil embedded *Entry pointer when a reader queries capabilities
for a tenant not yet seen by the rangefeed. If removeEntryForTenantIDLocked
was later called for that tenant, it accessed entry.Name through the nil
embedded pointer, causing a panic.

This can occur when a rangefeed restart re-delivers a delete event for
a tenant whose entry was already removed during a previous rangefeed
lifetime. If a reader called GetInfo for that tenant in the interim,
the store contains only the nil-Entry placeholder, and the re-delivered
delete dereferences it.

Epic: none


Release justification:

The Watcher's getInternal method inserts a placeholder watcherEntry
with a nil embedded *Entry pointer when a reader queries capabilities
for a tenant not yet seen by the rangefeed. If removeEntryForTenantIDLocked
was later called for that tenant, it accessed entry.Name through the nil
embedded pointer, causing a panic.

This can occur when a rangefeed restart re-delivers a delete event for
a tenant whose entry was already removed during a previous rangefeed
lifetime. If a reader called GetInfo for that tenant in the interim,
the store contains only the nil-Entry placeholder, and the re-delivered
delete dereferences it.

Epic: none
Release note (bug fix): Fixed a rare nil pointer dereference panic in
the tenant capabilities watcher that could occur when a tenant entry
was removed before it was fully populated by the rangefeed.

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@stevendanna stevendanna requested a review from a team as a code owner April 30, 2026 10:50
@blathers-crl blathers-crl Bot added blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. labels Apr 30, 2026
@blathers-crl
Copy link
Copy Markdown

blathers-crl Bot commented Apr 30, 2026

Thanks for opening a backport.

Before merging, please confirm that it falls into one of the following categories (select one):

  • Non-production code changes OR fixes for serious issues. Non-production includes test-only changes, build system changes, etc. Serious issues are defined in the policy as correctness, stability, or security issues, data corruption/loss, significant performance regressions, breaking working and widely used functionality, or an inability to detect and debug production issues.
  • Other approved changes. These changes must be gated behind a disabled-by-default feature flag unless there is a strong justification not to. Reference the approved ENGREQ ticket in the PR body (e.g., "Fixes ENGREQ-123").

Add a brief release justification to the PR description explaining your selection.

Also, confirm that the change does not break backward compatibility and complies with all aspects of the backport policy.

All backports must be reviewed by the TL and EM for the owning area.

@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io Bot commented Apr 30, 2026

Merging to release-25.4 in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@blathers-crl blathers-crl Bot added backport Label PR's that are backports to older release branches T-cli labels Apr 30, 2026
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@blathers-crl
Copy link
Copy Markdown

blathers-crl Bot commented Apr 30, 2026

Detected infrastructure failure (matched: self-hosted runner lost communication with the server). Automatically rerunning failed jobs. (run link)

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

Labels

backport Label PR's that are backports to older release branches blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. T-cli

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants