You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "rainerschamm (via GitHub)" <gi...@apache.org> on 2026/07/24 08:25:55 UTC
[PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
rainerschamm opened a new pull request, #17350:
URL: https://github.com/apache/iceberg/pull/17350
* Fixes #17349
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "rainerschamm (via GitHub)" <gi...@apache.org>.
rainerschamm commented on PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#issuecomment-5554031173
This still needs to be addressed. If necessary I can make some more changes. We have been running this in custom patch for a few months now though.
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "ujasur (via GitHub)" <gi...@apache.org>.
ujasur commented on PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#issuecomment-6486671761
We have been experiencing the same issue with the 1.12.0. That would be great if this lands as this issue has been reported many times by other folks!
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "rainerschamm (via GitHub)" <gi...@apache.org>.
rainerschamm commented on PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#issuecomment-6061839763
Need reviewer please.
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "hkwi (via GitHub)" <gi...@apache.org>.
hkwi commented on PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#issuecomment-5076323419
Thank you for reporting this in #17349 and for following up with the fix in
#17350. It looks like we independently ran into the same coordinator shutdown
issue.
I reviewed both #17349 and #17350, and I believe #16843 already covers the
reported failure mode. #16843 makes `CoordinatorThread.terminate()` wait for
the coordinator thread to exit, so the shutdown path reaches
`coordinator.stop()` before task shutdown continues. It also checks whether
the thread is still alive after the timeout and propagates interruption or
termination failures.
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "ajreid21 (via GitHub) via issues" <is...@iceberg.apache.org>.
ajreid21 commented on code in PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#discussion_r4482936715
##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/CommitterImpl.java:
##########
@@ -234,6 +237,13 @@ private void stopWorker() {
private void stopCoordinator() {
if (coordinatorThread != null) {
coordinatorThread.terminate();
+ try {
+ LOG.info("Asking coordinator thread to join for task {}", taskId);
+ coordinatorThread.join(COORDINATOR_THREAD_JOIN_WAIT_DURATION.toMillis());
Review Comment:
does this actually guarantee the coordinator thread is not alive anymore (particularly if it hits the wait timeout)? Do we need to check isAlive() and determine if the join timed out?
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "ajreid21 (via GitHub) via issues" <is...@iceberg.apache.org>.
ajreid21 commented on code in PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#discussion_r4483090986
##########
kafka-connect/kafka-connect/src/test/java/org/apache/iceberg/connect/channel/TestCommitterImpl.java:
##########
@@ -165,4 +167,37 @@ public void testStartFailurePropagatesAsNotRunningException()
.isInstanceOf(NotRunningException.class)
.hasMessageContaining("Coordinator unexpectedly terminated");
}
+
+ @Test
+ public void testCoordinatorStopCalledWhenCommitterClosed()
Review Comment:
probably need to add some more test cases for timeouts, interrupts, etc.
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#issuecomment-5465751869
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "wasniksudesh (via GitHub)" <gi...@apache.org>.
wasniksudesh commented on PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#issuecomment-6234925376
Hey!
I think this PR will greatly benefit from
https://github.com/apache/iceberg/pull/16843/changes#diff-a24a1ab4ce975d9b025a9eeb3f7df6f7b4ab24b21534186484ba441eb205a9baR160-R186 handling exceptions thrown during each kafka-client "close()".
I believe - CoordinatorThread will absolutely always run "coordinator.stop();" before exiting.
Do you happen to see any exceptions thrown with producer.close() [here](https://github.com/apache/iceberg/blob/main/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Channel.java#L235-L240) ?
Here's why I think join() might be helping for now =>
KafkaConsumer Thread might call `IcebergSinkTask` -> [close()](https://github.com/apache/iceberg/blob/main/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkTask.java#L63-L65) and follow it with `IcebergSinkTask `-> [open()](https://github.com/apache/iceberg/blob/main/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkTask.java#L58-L60) immediately.
(same might happen if the coordinator owning SinkTask restarts)
Two cases where open() might get called after close() immediately.
1. Consumer-Partition Rebalance : KafkaConsumer Thread calls SinkTask -> close() and then SinkTask -> open() when partitions are reassigned.
2. Task restart : Kafka Connect Runtime will wait for SinkTask -> stop() before starting another task instance. New task instance immediately joins the consumer-group and results in another SinkTask -> open().
In both cases, we must make sure either
1. existing producer is closed before returning SinkTask -> close()
2. any exception from existing producer (even if thrown later) is handled ([here](https://github.com/apache/iceberg/blob/main/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Channel.java#L238-L239))
right now `close()` doesn't block on "coordinator.stop();", so doesn't wait for existing producer to close (via [producer.close()](https://github.com/apache/iceberg/blob/main/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Channel.java#L237)).
An `open()` immediately after will create a new producer-client. Since these are transactional-producers -> stale producer is expected to throw exception. (even with [close()](https://github.com/a0x8o/kafka/blob/master/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java#L1264-L1280)).
So if an open() happens and creates a new producer client - and CoordinatorThread performs `producer.close()` next -> an exception will be thrown and will **skip** 'consumer.close()' (https://github.com/apache/iceberg/blob/main/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Channel.java#L238-L239).
The current PR might help because it blocks IcebergSinkTask -> close() (https://github.com/apache/iceberg/blob/main/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkTask.java#L67-L83) long enough until CoordinatorThread finishes and closes existing producer (and then consumer) , before next `IcebergSinkTask -> open()` is called.
-> But if the join() times-out - we must make sure exceptions from "producer.close()" are handled.
I think just handling exceptions [here](https://github.com/apache/iceberg/blob/main/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Channel.java#L238-L239) would also prevent leaking consumer.
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "rainerschamm (via GitHub)" <gi...@apache.org>.
rainerschamm commented on PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#issuecomment-5132090886
> Thank you for reporting this in #17349 and for following up with the fix in #17350. It looks like we independently ran into the same coordinator shutdown issue.
>
> I reviewed both #17349 and #17350, and I believe #16843 already covers the reported failure mode. #16843 makes `CoordinatorThread.terminate()` wait for the coordinator thread to exit, so the shutdown path reaches `coordinator.stop()` before task shutdown continues. It also checks whether the thread is still alive after the timeout and propagates interruption or termination failures.
Cool, yes I did see the coordinator thread join logic. I am finding it slightly harder to review though. It seems easier to understand to me if the orchestrator or "owner" of the thread also does the join().
```java
coordinatorThread = new CoordinatorThread(coordinator);
coordinatorThread.start();
```
```java
if (coordinatorThread != null) {
coordinatorThread.terminate();
try {
LOG.info("Asking coordinator thread to join for task {}", taskId);
coordinatorThread.join(COORDINATOR_THREAD_JOIN_WAIT_DURATION.toMillis());
LOG.info("Coordinator thread joined for task {}", taskId);
} catch (InterruptedException e) {
LOG.warn("Coordinator thread join interrupted for task {}", taskId, e);
}
coordinatorThread = null;
}
```
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "ajreid21 (via GitHub) via issues" <is...@iceberg.apache.org>.
ajreid21 commented on code in PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#discussion_r4483075432
##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/CommitterImpl.java:
##########
@@ -234,6 +237,13 @@ private void stopWorker() {
private void stopCoordinator() {
if (coordinatorThread != null) {
coordinatorThread.terminate();
+ try {
+ LOG.info("Asking coordinator thread to join for task {}", taskId);
+ coordinatorThread.join(COORDINATOR_THREAD_JOIN_WAIT_DURATION.toMillis());
+ LOG.info("Coordinator thread joined for task {}", taskId);
+ } catch (InterruptedException e) {
+ LOG.warn("Coordinator thread join interrupted for task {}", taskId, e);
Review Comment:
think you actually need to handle the interrupt?
The code in the other linked PR I think handles these 2 issues i brought up here better:
https://github.com/apache/iceberg/pull/16843/changes#diff-efaeae404d4a0229eaef976261a45f937c8323ba828acd94b7b72f4ca9af4b87R69
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "rainerschamm (via GitHub)" <gi...@apache.org>.
rainerschamm commented on PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#issuecomment-5069684301
> @rainerschamm This seems to be overlapping with #16843. cc @hkwi
Ah yes thanks, there is a bit of overlap.
--
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: [PR] Connect: Fix coordinator consumer group on iceberg control topic with… [iceberg]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #17350:
URL: https://github.com/apache/iceberg/pull/17350#issuecomment-6028119398
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.
--
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