You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "kuldeep0508 (via GitHub)" <gi...@apache.org> on 2026/07/14 08:04:01 UTC
[I] Kafka Connect: `cg-control` consumer group fails to stabilize on idle/low-volume topics after PR #14395 [iceberg]
kuldeep0508 opened a new issue, #17193:
URL: https://github.com/apache/iceberg/issues/17193
### Apache Iceberg version
1.11.0 (latest release)
### Query engine
Kafka Connect
### Please describe the bug 🐞
### Summary
After upgrading from Iceberg 1.10.1 to 1.11.0, the Kafka Connect Iceberg Sink connector's `cg-control` consumer group cannot reach STABLE state when the data topic goes idle after initial consumption. This causes all commits to timeout with "committed to 0 table(s)".
The regression was introduced by PR #14395 ("Don't check that consumer group is stable for coordinator leader election"), which removed the stability check that previously ensured the Worker's `cg-control` consumer had joined before the Coordinator started firing commits.
### Root Cause
In 1.10.1, the Coordinator waited for the `cg-control` consumer group to be STABLE before starting commit cycles. In 1.11.0, this check was removed. The unintended consequence:
1. Connector starts → consumes all available messages in the first `poll()` call
2. Data topic now has no new messages → next `poll()` blocks for `max.poll.interval.ms` (default 60s)
3. During this 60s block, the `cg-control` consumer's `poll()` is not called (single-threaded task loop)
4. `cg-control` session timeout is 45s (default `session.timeout.ms`)
5. After 45s with no heartbeat → broker kicks `cg-control` member → `UnknownMemberIdException`
6. `cg-control` can never reach STABLE → Worker never processes START_COMMIT → commit always times out
The 45s session timeout < 60s poll block creates a guaranteed failure condition whenever the data topic goes idle.
### Steps to Reproduce
1. Deploy Iceberg Sink Connector 1.11.0 in distributed mode with `tasks.max=1`
2. Have a data topic with a finite set of messages (e.g., a CDC snapshot — no continuous flow)
3. Configure `iceberg.control.commit.interval-ms: 60000` (or any value > session timeout)
4. Start the connector from a clean state (no internal topics)
5. Connector consumes all messages in first poll
6. Topic goes idle → `cg-control` consumer can never join → all commits timeout with 0 tables
### Expected Behavior
The `cg-control` consumer group should reach STABLE state regardless of data topic activity. Either:
- The Coordinator should wait for `cg-control` stability before firing the first commit (as in 1.10.1)
- Or the `cg-control` consumer's `poll()` should be decoupled from the data consumer's poll loop (separate thread)
### Actual Behavior
```
[TRACE] Polling returned 454 messages ← All consumed in first poll
[TRACE] Delivering batch of 454 messages ← Delivered to put()
... 60s passes (data poll blocks) ...
[INFO] Commit timeout reached → committed to 0 table(s)
[INFO] [cg-control-*] Request joining group due to: rebalance failed due to
'The coordinator is not aware of this member.' (UnknownMemberIdException)
```
The `cg-control` consumer repeatedly fails to join:
```
sessionTimeoutMs=45000 ← Broker kicks after 45s
rebalanceTimeoutMs=300000
```
But the main task loop only iterates every 60s (poll timeout), so `cg-control` gets only one `poll()` call per 60s — insufficient to maintain the 45s session.
### Comparison: 1.10.1 vs 1.11.0
| Version | `cg-control` State | Commits Work? | Behavior |
|---------|-------------------|---------------|----------|
| 1.10.1 | STABLE ✅ | Yes | Coordinator waits for stability |
| 1.11.0 | EMPTY ❌ | No | Coordinator fires immediately |
Tested with identical connector config on the same Kafka cluster. The only difference is the Iceberg plugin version.
### Workaround
Setting `iceberg.kafka.session.timeout.ms` to a value greater than the data consumer's poll timeout:
```json
"iceberg.kafka.session.timeout.ms": "120000",
"iceberg.kafka.heartbeat.interval.ms": "10000"
```
This passes through to the `cg-control` consumer via the `iceberg.kafka.*` prefix, preventing the session from expiring during the idle poll block.
Alternatively, ensuring continuous data flow keeps the poll loop short, allowing `cg-control` to join — but this is not a viable solution for batch/snapshot workloads.
### Related Issues
- [#11818 ](https://github.com/apache/iceberg/issues/11818)— "Iceberg Kafka Connector experiences a constant hanging lag for low-volume topics" (same symptom, reported on 1.7.1, closed as stale)
- [#14395](https://github.com/apache/iceberg/pull/14395)— The PR that introduced this regression
### Environment
- Kafka Connect: 3.9.2 (distributed mode)
- Kafka Broker: Amazon MSK 3.9.2
- Iceberg Sink: 1.11.0 (built from `apache-iceberg-1.11.0` tag)
- `tasks.max`: 1
- `iceberg.control.commit.interval-ms`: 60000
- Data topic: 454 messages (CDC snapshot, no continuous flow)
### Willingness to contribute
- [ ] I can contribute a fix for this bug independently
- [x] I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Kafka Connect: `cg-control` consumer group fails to stabilize on idle/low-volume topics after PR #14395 [iceberg]
Posted by "dilverse (via GitHub)" <gi...@apache.org>.
dilverse commented on issue #17193:
URL: https://github.com/apache/iceberg/issues/17193#issuecomment-5857623730
We reproduced this on stock Iceberg 1.11.0 (Kafka Connect 4.3.1, classic consumer protocol, default sink settings) and can confirm the mechanism, including which group fails.
**The failing group** is the Worker's `cg-control-<uuid>`, not the Connect or `-coord` group.
**Why the background heartbeat does not help:** the classic consumer starts its heartbeat thread only after it has handled its JoinGroup response inside `poll()` (`AbstractCoordinator`: disabled while the member has not joined). The Worker is created on the first non-empty `put()`, `Channel.start()` polls for only 1s (a new group's first join waits `group.initial.rebalance.delay.ms`, 3s by default), and afterwards the control consumer is polled only with `poll(Duration.ZERO)` from `put()`/`flush()`. On an idle topic Connect calls `put()` once per `offset.flush.interval.ms` (60s), so the JoinGroup response is handled about 60s later, after the 45s session has expired: `UNKNOWN_MEMBER_ID`, rejoin, forever. A member that has already joined keeps its session through the heartbeat thread, so only a join that starts just before the topic goes idle is affected (a small snapshot, a low-volume topic).
**Repro:** two connectors side by side, schemaless JSON, `iceberg.control.commit.interval-ms` left at its default.
- Idle (3 records, then nothing): JoinGroup sent at 04:23:40, response handled at 04:24:36, then `SyncGroup failed: The coordinator is not aware of this member`. 9 commit rounds over 45 minutes all ended "committed to 0 table(s)".
- Busy (1 record every 5s): joined in 5s and committed every round.
**Not a 1.11 regression:** 1.10.1 has the same lazy Worker creation and the same 1s poll in `Channel.start()`. #14395 changed only leader election, which matches #11818 seeing this on 1.7.1.
**Fix we are running:** `Worker.start()` polls until the control consumer has its assignment, bounded by `iceberg.control.commit.timeout-ms`; after that the heartbeat thread holds the membership. With only this change and default settings, the stuck idle connector joined within 3s and committed its 3 records within the next rounds. The patch and a `TestWorker` case (fails on 1.11.0, passes with the patch) apply cleanly to `main`; we can open a PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Kafka Connect: `cg-control` consumer group fails to stabilize on idle/low-volume topics after PR #14395 [iceberg]
Posted by "vbhanuchander-lang (via GitHub)" <gi...@apache.org>.
vbhanuchander-lang commented on issue #17193:
URL: https://github.com/apache/iceberg/issues/17193#issuecomment-5274641634
I looked into this because the symptom is corroborated (#11818 reports the same "constant hanging
lag for low-volume topics"), but I do not think the stated mechanism can be what is happening.
Four things in the chain do not match the code. I am posting them because they change what needs
fixing, not to argue the bug away.
**1. #14395 did not remove a `cg-control` readiness check.** The check it removed was on
`config.connectGroupId()` — the *Connect* consumer group for the data topic — inside
`CommitterImpl.hasLeaderPartition`, and its purpose was coordinator **leader election** (deciding
which task owns the first partition):
```java
- if (groupDesc.state() == ConsumerGroupState.STABLE) {
- Collection<MemberDescription> members = groupDesc.members();
- if (containsFirstPartition(members, currentAssignedPartitions)) { ... }
- }
```
It never inspected the control group, so it cannot have been "ensuring the Worker's `cg-control`
consumer had joined".
**2. `put()` is still called when the data topic is idle.** Step 3 assumes the control consumer's
`poll()` is not called during the block. It is: in `WorkerSinkTask.poll()`, `deliverMessages()` —
and therefore `task.put(...)` — is invoked **unconditionally** after `convertMessages(msgs)`, with
no non-empty guard:
```java
convertMessages(msgs);
deliverMessages(); // -> task.put(new ArrayList<>(messageBatch)), even when empty
```
So `Channel.consumeAvailable` still runs on every Connect poll cycle on an idle topic.
**3. The 60s figure is `offset.flush.interval.ms`, not `max.poll.interval.ms`.**
`WorkerSinkTask.iteration()` polls with the time remaining until the next offset commit:
```java
long timeoutMs = Math.max(nextCommit - now, 0);
poll(timeoutMs);
```
`nextCommit` advances by `OFFSET_COMMIT_INTERVAL_MS_CONFIG` (`offset.flush.interval.ms`), whose
default is `60000L` in `WorkerConfig`. `max.poll.interval.ms` defaults to **300000**, not 60000
(`ConsumerConfig`, line 607). So the idle gap between `put()` calls is ~60s and bounded by a Connect
worker setting.
**4. A 60s gap between polls does not trip `session.timeout.ms`.** Since KIP-62 the consumer
heartbeats from a background thread, so `session.timeout.ms` (default 45000, confirmed in
`ConsumerConfig`) covers heartbeat loss, not time between `poll()` calls. The config that evicts a
member for not polling is `max.poll.interval.ms` — 300s here, which a 60s gap does not breach. That
is also why raising `heartbeat.interval.ms`, as suggested, would not be the lever even if the timing
were as described.
**What I could not explain, and what would pin it down**
The Worker's control group is created per worker instance as
`config.controlGroupIdPrefix() + UUID.randomUUID()` (`Worker.java:53`), i.e. a fresh
**single-member** group named `cg-control-<uuid>`. A single-member group that owns its own group id
reaching a non-STABLE state indefinitely is genuinely odd, and the `UnknownMemberIdException` you
saw is real evidence of *something*, so I would rather find the actual cause than hand-wave.
Two things would settle it:
1. The exact group id in the `UnknownMemberIdException` — is it `cg-control-<uuid>`, the
`<connectGroupId>-coord` group the Coordinator uses (`Coordinator.java:97`), or the Connect group
itself? These are three different groups and the fix differs for each.
2. Whether a fresh `cg-control-<uuid>` group is created on every task restart. If restarts are
frequent, abandoned single-member groups accumulate, and it is worth checking whether the group
being described as "not STABLE" is a previous incarnation rather than the live one.
If the real problem turns out to be that the coordinator can now start a commit cycle before workers
have joined — which is a plausible consequence of #14395, just not via `cg-control` liveness — then
the fix belongs in the leader-election/commit-start path, and I am happy to work on it. But I did
not want to write a patch against a mechanism I had just shown does not hold.
*(Config defaults and the `WorkerSinkTask` behaviour above were read from the Kafka 3.9 sources,
matching the 3.9.2 runtime in your environment section.)*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org