cockroachdb / cockroachdb/cockroach

changefeedccl: descriptor leases leaked in rowFetcherCache and unbounded wait in changeAggregator.close

Open
#174,956 2 comments 0 reactions 0 assignees View on GitHub
A-cdc C-bug O-agent T-cdc
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Summary:**

Two changefeed paths hold resources across a failure that skips their release. Part of #174944.

**Findings:**

- `cdcevent.rowFetcherCache.refreshUDT`: the cache holds a node-lifetime `*descs.Collection` as a struct field and calls `ReleaseAll` only on the success path; both error returns leave the leases held. Because the collection is never torn down, the leaked refcounts persist for the process lifetime, which stalls DDL on the affected descriptors cluster-wide rather than expiring with a lease. Reachable from every changefeed with UDT columns, and it fires on ordinary errors today. It also reuses a per-transaction object across transactions.
- `changefeedccl.changeAggregator.close`: a bare `<-ca.kvFeedDoneCh` receive with no timeout, as the second of eight unguarded cleanup steps. If the kvfeed goroutine is wedged, flow cleanup hangs; for a remote flow that parks the stopper waiter task, which blocks node drain.

**Next Steps:**

- [ ] `defer collection.ReleaseAll(ctx)` in `refreshUDT`
- [ ] Bound the `kvFeedDoneCh` receive with a timeout and a loud log
- [ ] Consider whether the remaining seven cleanup steps in `changeAggregator.close` should each be independently guarded

Epic: none

Jira issue: CRDB-68127

Contributor guide

Open the contributing guide

Research direction

Start at cdcevent.rowFetcherCache.refreshUDT and changefeedccl.changeAggregator.close, tracing both error paths and the kvFeedDoneCh cleanup. Done means descriptor leases are released after failures, close cannot wait forever on a wedged kvfeed, and the timeout emits a loud log; review whether the other seven cleanup steps need independent guards.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.