Skip to content

release-26.1: sql/backfill: report panics in backfill goroutines#169207

Merged
trunk-io[bot] merged 1 commit intocockroachdb:release-26.1from
rafiss:backport26.1-169062
Apr 28, 2026
Merged

release-26.1: sql/backfill: report panics in backfill goroutines#169207
trunk-io[bot] merged 1 commit intocockroachdb:release-26.1from
rafiss:backport26.1-169062

Conversation

@rafiss
Copy link
Copy Markdown
Collaborator

@rafiss rafiss commented Apr 28, 2026

Backport 1/1 commits from #169062 on behalf of @rafiss.


The index backfiller and the MVCC index merger each spawn goroutines that, until now, had no panic recovery. A panic inside the goroutine spawned by indexBackfiller.Run (or one re-thrown from a ctxgroup worker by g.Wait) would tear down the SQL pod with no Sentry report and no CRDB-formatted log entry — only the Go runtime's bare stderr dump.

Switch the indexBackfiller goroutine to stopper.RunAsyncTaskEx so that the stopper's recover wrapper reports the panic to Sentry before re-panicking. The MVCC index merger keeps its bare goroutine because Run depends on g.Wait returning before the deferred memory monitor cleanup runs (a refused stopper task would force an early return with workers still using the bound account); instead it gets a
defer logcrash.RecoverAndReportPanic so the same Sentry visibility applies.

Both changes are defense in depth: the SQL pod still crashes after a panic in either path, but now the crash is observable instead of silent.

Informs: #169059
Epic: none

Release note: None


Release justification: Observability for production crashes: defense-in-depth fix that enables Sentry reporting for otherwise-silent SQL pod crashes during index backfill/merge.

The index backfiller and the MVCC index merger each spawn goroutines
that, until now, had no panic recovery. A panic inside the goroutine
spawned by indexBackfiller.Run (or one re-thrown from a ctxgroup worker
by g.Wait) would tear down the SQL pod with no Sentry report and no
CRDB-formatted log entry — only the Go runtime's bare stderr dump.

Switch the indexBackfiller goroutine to stopper.RunAsyncTaskEx so that
the stopper's recover wrapper reports the panic to Sentry before
re-panicking. The MVCC index merger keeps its bare goroutine because Run
depends on g.Wait returning before the deferred memory monitor cleanup
runs (a refused stopper task would force an early return with workers
still using the bound account); instead it gets a
defer logcrash.RecoverAndReportPanic so the same Sentry visibility
applies.

Both changes are defense in depth: the SQL pod still crashes after a
panic in either path, but now the crash is observable instead of silent.

Informs: cockroachdb#169059
Epic: none

Release note: None

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@blathers-crl
Copy link
Copy Markdown

blathers-crl Bot commented Apr 28, 2026

Thanks for opening a backport.

Before merging, please confirm that the change does not break backwards compatibility and otherwise complies with the backport policy. Include a brief release justification in the PR description explaining why the backport is appropriate. All backports must be reviewed by the TL for the owning area. While the stricter LTS policy does not yet apply, please exercise judgment and consider gating non-critical changes behind a disabled-by-default feature flag when appropriate.

@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io Bot commented Apr 28, 2026

😎 Merged successfully - details.

@blathers-crl blathers-crl Bot added backport Label PR's that are backports to older release branches T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) labels Apr 28, 2026
@blathers-crl
Copy link
Copy Markdown

blathers-crl Bot commented Apr 28, 2026

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@rafiss rafiss marked this pull request as ready for review April 28, 2026 15:31
@rafiss rafiss requested a review from a team as a code owner April 28, 2026 15:31
@rafiss rafiss requested review from mw5h and spilchen and removed request for a team April 28, 2026 15:31
Copy link
Copy Markdown
Contributor

@spilchen spilchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rafiss
Copy link
Copy Markdown
Collaborator Author

rafiss commented Apr 28, 2026

/trunk merge

@trunk-io trunk-io Bot merged commit 501a79c into cockroachdb:release-26.1 Apr 28, 2026
22 checks passed
@rafiss rafiss deleted the backport26.1-169062 branch May 1, 2026 20:57
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 T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) target-release-26.1.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants