[
https://issues.apache.org/jira/browse/KAFKA-6783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
John Roesler resolved KAFKA-6783.
---------------------------------
Resolution: Duplicate
Hey [~koqizhao],
We've merged
[https://github.com/apache/kafka/commit/c470ff70d3e829c8b12f6eb6cc812c4162071a1f]
under KAFKA-5697, which should fix this issue. In retrospect, your ticket
would have been a more appropriate scope for the work, but it's too late to
change the commit title now.
I'm marking this ticket as a duplicate just to provide a pointer to the ticket
under which the issue is fixed.
If you feel the issue still persists in some form, please feel free to re-open
the ticket or start a new one.
Also note, there is a similar issue with several other consumer methods, which
we plan to fix under KIP-266. Poll is likely to be the only one to make it into
2.0, though.
Thanks,
-John
> consumer poll(timeout) blocked infinitely when no available bootstrap server
> ----------------------------------------------------------------------------
>
> Key: KAFKA-6783
> URL: https://issues.apache.org/jira/browse/KAFKA-6783
> Project: Kafka
> Issue Type: Bug
> Components: clients
> Affects Versions: 1.1.0
> Reporter: Qiang Zhao
> Priority: Major
> Labels: features
> Fix For: 2.0.0
>
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> {code:java}
> @Test
> public void testPollWithAllBootstrapServersDown() throws Exception {
> ExecutorService executor = Executors.newSingleThreadExecutor();
> try {
> final long pollTimeout = 1000;
> final AtomicBoolean pollComplete = new AtomicBoolean();
> executor.submit(new Runnable() {
> @Override
> public void run() {
> Properties props = new Properties();
> props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
> "localhost:29092");
> try (KafkaConsumer<byte[], byte[]> consumer =
> newConsumer(props)) {
> consumer.subscribe(Arrays.asList(topic));
> try {
> consumer.poll(pollTimeout);
> } catch (Exception ex) {
> ex.printStackTrace();
> } finally {
> pollComplete.set(true);
> }
> }
> }
> });
> Thread.sleep(pollTimeout * 2);
> Assert.assertTrue("poll timeout not work when all servers down",
> pollComplete.get());
> } finally {
> executor.shutdown();
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)