[Bug]: Kafka reader close races with a background fetch after cancellation at a batch boundary

Abierto
#33,359 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@matrix-meow ya está trabajando en esto.

Desde el 27/11/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

kind/bug needs-triage
Is there an existing issue for the same bug?
  • I have checked the existing issues.
Branch Name

v4.2.8-hotfix

Commit ID

Observed on PR head 67e6deb3948af36d563e9637365e017d085e1da8 against 21b9b39bbca86a981e3a77b370c51cb602b88637.

Other Environment Information

Ubuntu x86-64 CI, Go 1.26.4 with the race detector, franz-go v1.21.6.

Actual Behavior

The race detector failed TestKafkaReaderCancelAtBatchBoundary while KafkaReader.Close was closing the Kafka client. The closing goroutine read fetch-session state in kgo.(*Client).close.func2 (client.go:1345) while the fetch goroutine updated it in (*fetchSession).bumpEpoch (source.go:2923). Additional reports show killSessionOnClose racing with commitFromReq on the same session. The failing test, its setup helpers, the reader implementation and the pinned dependency versions match the target branch. Failed CI job and race report

Expected Behavior

Closing a Kafka reader after cancellation at a batch boundary safely joins its background fetch activity.

Steps to Reproduce

Run the existing test with the race detector in a CGo-enabled checkout. The failure is timing dependent.

GOTOOLCHAIN=go1.26.4 .agents/skills/mo-dev/scripts/mo-cgo-test -race -run '^TestKafkaReaderCancelAtBatchBoundary$' -count=100 ./pkg/sql/colexec/external
Additional information

The test opens a reader against a one-broker kfake cluster, cancels before the next batch starts, verifies that the read reports cancellation, and closes the reader. CI detected the race during the final close.

Lenguaje dominante
Go
Estrellas
1.9k
Forks
312
Merge medio
22 h 59 min
PR fusionados (30 d)
736

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de matrixorigin/matrixone

Todos los issues de matrixorigin/matrixone

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.