cockroachdb / cockroachdb/cockroach

crosscluster/logical: transactional LDR applier coordinator busy-spins at 100% CPU when input channel closes

Open Beginner friendly
#172,371 2 comments 0 reactions 0 assignees View on GitHub
A-logical-data-replication C-bug O-agent T-cdc
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Describe the problem**

`Applier.coordinator`'s `case batch := <-input:` has no closed-channel check,
and the applier processor does `defer close(p.applierEvents)` when
`runInputReader` returns. A closed channel makes the coordinator hot-loop on nil
batches until the group context is cancelled.

**Impact**

Conflict-driven teardown is the *normal* convergence mechanism, so each retry
attempt burns a core per applier for the teardown window; on a clean coordinator
EOF the spin is unbounded. (Found independently by two reviewers.)

**Code references**
- [txnapply/txn_applier.go:349-358](https://github.com/cockroachdb/cockroach/blob/master/pkg/crosscluster/logical/txnapply/txn_applier.go#L349-L358)

**Suggested fix**

`batch, ok := <-input; if !ok { return nil }`.

Epic CRDB-65552

Jira issue: CRDB-65606

Contributor guide

Open the contributing guide

Research direction

Start in pkg/crosscluster/logical/txnapply/txn_applier.go at lines 349-358 and inspect the coordinator's input-channel handling alongside the deferred channel close in the issue description. Confirm the closed-channel path exits cleanly, then run the relevant txnapply tests or teardown checks available in the repository and verify the coordinator no longer spins after input closes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
database, distributed-systems
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.