Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-18276

NullPointerException (and potential leak) when closing KafkaConsumer after exception in reassignPartitions

    XMLWordPrintableJSON

Details

    Description

      WARN  org.apache.flink.streaming.connectors.kafka.internal.KafkaFetcher  - Error while closing Kafka consumer
      java.lang.NullPointerException
      	at org.apache.flink.streaming.connectors.kafka.internal.KafkaConsumerThread.run(KafkaConsumerThread.java:282)
      

      KafkaConsumerThread#reassignPartitions is temporarily setting consumer to null and if there is an exception (in this case, it was a timeout), the finally block in KafkaConsumerThread.run would fail with an NPE. Even more so, KafkaConsumerThread#reassignPartitions put the original consumer into consumerTmp which is not closed now and may leak underlying (Kafka) resources.

      Attachments

        Activity

          People

            Unassigned Unassigned
            nkruber Nico Kruber
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: