Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import org.apache.kafka.common.errors.InvalidTopicException;
import org.apache.kafka.common.errors.TimeoutException;
import org.apache.kafka.common.errors.TopicAuthorizationException;
import org.apache.kafka.common.errors.UnknownServerException;
import org.apache.kafka.common.internals.ClusterResourceListeners;
import org.apache.kafka.common.metrics.KafkaMetric;
import org.apache.kafka.common.metrics.Metrics;
Expand Down Expand Up @@ -1265,7 +1266,8 @@ void processBackgroundEventsOnClose() {
try {
processBackgroundEvents();
} catch (Exception e) {
if (!(e instanceof GroupAuthorizationException || e instanceof TopicAuthorizationException || e instanceof InvalidTopicException))
if (!(e instanceof GroupAuthorizationException || e instanceof TopicAuthorizationException
|| e instanceof InvalidTopicException || e instanceof UnknownServerException))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intended as a bug fix? the exception thrown by processBackgroundEventsOnClose will be handled by swallow

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, but it will then set firstException in ShareConsumerImpl.close(Duration, boolean) and the exception will eventually be thrown by that method.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, since we are swallowing UnknownServerException in processBackgroundEventsOnClose, shouldn't we do the same in sendAcknowledgementsAndLeaveGroup for consistency? Both are steps in the close sequence.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was thinking that. There's no hurry to get this into 4.3 because it just fixes a minimally flaky test. I'll spend a bit more time here.

throw e;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ public void testMissingTopicPartitionSelection() {

@Test
public void testInvalidBroker() {
// Use RFC 5737 TEST-NET-1 (192.0.2.0/24) - a non-routable address reserved for
// documentation and testing. This address guarantees a connection timeout.
Throwable e = assertThrows(AdminCommandFailedException.class, () -> LeaderElectionCommand.run(
Duration.ofSeconds(1),
"--bootstrap-server", "example.com:1234",
"--bootstrap-server", "192.0.2.1:9092",
"--election-type", "unclean",
"--all-topic-partitions"
));
Expand Down
Loading