Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-6783

consumer poll(timeout) blocked infinitely when no available bootstrap server

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 1.1.0
    • Fix Version/s: None
    • Component/s: clients
    • Labels:
    • Flags:
      Important

      Description

          @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();
              }
          }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                koqizhao Qiang Zhao
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 48h
                  48h
                  Remaining:
                  Remaining Estimate - 48h
                  48h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified