You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Qiang Zhao (JIRA)" <ji...@apache.org> on 2018/04/12 14:02:00 UTC
[jira] [Created] (KAFKA-6783) consumer poll(timeout) blocked
infinitely when no available bootstrap server
Qiang Zhao created KAFKA-6783:
---------------------------------
Summary: 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
Fix For: 1.2.0
{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)