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

Possible NPE is thrown in MirrorCheckpointTask

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 2.8.1, 3.6.0
    • 3.5.2, 3.7.0, 3.6.1
    • mirrormaker
    • None

    Description

      In the `syncGroupOffset` method, if `targetConsumerOffset.get(topicPartition)` gets null, then the calculation of `latestDownstreamOffset` will throw NPE. This usually occurs in this situation: a group consumed a topic in the target cluster previously. Later, the group offset of some partitions was reset to -1, the `OffsetAndMetadata` of these partitions was null.

      It is possible that when reset offsets are performed in the java kafka client, the reset to -1 will be intercepted. However, there are some other types of clients such as sarama, which can magically reset the group offset to -1, so MM2 will trigger an NPE exception in this scenario. Therefore, a defensive measure to avoid NPE is needed here.

      Attachments

        1. SeaTalk_IMG_20231019_174340.png
          210 kB
          hudeqi
        2. SeaTalk_IMG_20231019_172945.png
          209 kB
          hudeqi

        Issue Links

          Activity

            People

              hudeqi hudeqi
              hudeqi hudeqi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: