Skip to content

fix(kafka): keep group consumer polling while Finish waits on deferred acks - #115

Merged
Divyanshu Tiwari (divyanshu-tiwari) merged 2 commits into
mainfrom
fix/kafka-heartbeat-during-finish
Sep 8, 2026
Merged

fix(kafka): keep group consumer polling while Finish waits on deferred acks#115
Divyanshu Tiwari (divyanshu-tiwari) merged 2 commits into
mainfrom
fix/kafka-heartbeat-during-finish

Conversation

@divyanshu-tiwari

@divyanshu-tiwari Divyanshu Tiwari (divyanshu-tiwari) commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Group consumers stop polling once max_records, end_after, or retry_limit fires. Finish then waits for downstream tasks to settle before committing stored offsets.
  • When downstream work (e.g. slow HTTP scraping or fan-in joins) exceeds librdkafka's max.poll.interval.ms (default 5 minutes), librdkafka deems the consumer dead, leaves the consumer group (MAXPOLL ... leaving group), and the subsequent offset commit fails with warning: failed to commit offsets for topic ...: Broker: Unknown member.
  • Observed in production during Destiny Walmart SERP scraping (max_records: 900 followed by 10-25m HTTP drain across 50 workers).
  • Fix:
    1. pauseAll() assigned partitions on read loop exit so subsequent polls during shutdown do not fetch new messages.
    2. In Finish(), use waitWhile(k.tracker.Wait, k.heartbeatPoll) to keep polling librdkafka every 1s while waiting for deferred acks to settle.
    3. Document the MAXPOLL / Unknown member failure mode in Kafka task docs.
  • Note: Relates to data-airflow#6146 which adjusts HTTP timeout and retries on Walmart Destiny.

Test plan

  • Validated waitWhile polling mechanics under race detector with unit test (PASS)
  • Ran go test -v -race ./internal/pkg/pipeline/task/kafka/... ./internal/pkg/pipeline/ack/...
  • Verify Destiny Walmart scrape shard completes without MAXPOLL leaving group and successfully commits offsets in Finish on test deploy

…d acks

Group consumers stop polling once max_records, end_after, or retry_limit
fires. Finish then waits for downstream tasks to settle, which for slow
HTTP or sink drains exceeds max.poll.interval.ms (5m) and causes librdkafka
to leave the group and fail the final commit with Broker: Unknown member.
@divyanshu-tiwari
Divyanshu Tiwari (divyanshu-tiwari) merged commit 0e74741 into main Sep 8, 2026
7 checks passed
@divyanshu-tiwari
Divyanshu Tiwari (divyanshu-tiwari) deleted the fix/kafka-heartbeat-during-finish branch September 8, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants