Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-22985

Gracefully handle invalid ServiceLoader entries

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Patch Available
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: metrics
    • Labels:
      None

      Description

      Just saw this happen: A RegionServer failed to start because, on the classpath, there was a META-INF/services entry in a JAR on the classpath that was advertising an implementation of org.apache.hadoop.hbase.metrics.MetricsRegistries but was an implementation of a completely different class:

      Caused by: java.util.ServiceConfigurationError: org.apache.hadoop.hbase.metrics.MetricRegistries: Provider org.apache.ratis.metrics.impl.MetricRegistriesImpl not a subtype
      	at java.util.ServiceLoader.fail(ServiceLoader.java:239)
      	at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
      	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
      	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
      	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
      	at org.apache.hadoop.hbase.metrics.MetricRegistriesLoader.getDefinedImplemantations(MetricRegistriesLoader.java:92)
      	at org.apache.hadoop.hbase.metrics.MetricRegistriesLoader.load(MetricRegistriesLoader.java:50)
      	at org.apache.hadoop.hbase.metrics.MetricRegistries$LazyHolder.<clinit>(MetricRegistries.java:39)
      	at org.apache.hadoop.hbase.metrics.MetricRegistries.global(MetricRegistries.java:47)
      	at org.apache.hadoop.hbase.metrics.BaseSourceImpl.<init>(BaseSourceImpl.java:122)
      	at org.apache.hadoop.hbase.io.MetricsIOSourceImpl.<init>(MetricsIOSourceImpl.java:46)
      	at org.apache.hadoop.hbase.io.MetricsIOSourceImpl.<init>(MetricsIOSourceImpl.java:38)
      	at org.apache.hadoop.hbase.regionserver.MetricsRegionServerSourceFactoryImpl.createIO(MetricsRegionServerSourceFactoryImpl.java:84)
      	at org.apache.hadoop.hbase.io.MetricsIO.<init>(MetricsIO.java:35)
      	at org.apache.hadoop.hbase.io.hfile.HFile.<clinit>(HFile.java:195)
      	at org.apache.hadoop.hbase.regionserver.HRegionServer.<init>(HRegionServer.java:570)
      	... 10 more

      Now, we could catch this and gracefully ignore it; however, this would mean that we're catching an Error which is typically considered a smell.

      It's a pretty straightforward change, so I'm apt to think that it's OK. What do other folks think?

        Attachments

        1. HBASE-22985.002.patch
          5 kB
          Josh Elser
        2. HBASE-22985.001.patch
          5 kB
          Josh Elser

          Activity

            People

            • Assignee:
              elserj Josh Elser
              Reporter:
              elserj Josh Elser
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: