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

UnsupportedOperation when querying cleaner metrics after shutdown

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.6.0
    • Component/s: None
    • Labels:
      None

      Description

      We have a few log cleaner metrics which iterate the set of cleaners. For example:

        newGauge("max-clean-time-secs", () => cleaners.iterator.map(_.lastStats.elapsedSecs).max.toInt)
      

      It seems possible currently for LogCleaner metrics to get queried after shutdown of the log cleaner, which clears the `cleaners` collection. This can lead to the following error:

      java.lang.UnsupportedOperationException: empty.max
      	at scala.collection.IterableOnceOps.max(IterableOnce.scala:952)
      	at scala.collection.IterableOnceOps.max$(IterableOnce.scala:950)
      	at scala.collection.AbstractIterator.max(Iterator.scala:1279)
      	at kafka.log.LogCleaner.kafka$log$LogCleaner$$$anonfun$new$9(LogCleaner.scala:132)
      	at kafka.log.LogCleaner$$anonfun$4.value(LogCleaner.scala:132)
      	at kafka.log.LogCleaner$$anonfun$4.value(LogCleaner.scala:132)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                chia7712 Chia-Ping Tsai
                Reporter:
                hachikuji Jason Gustafson
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: