Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-15009

DirectoryFactory exists masks IOExceptions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 8.4.1
    • 8.8, 9.0
    • None

    Description

      This NPE was seen on a cluster running 8.4.1 -

      o.a.s.h.RequestHandlerBase java.lang.NullPointerException
      	at org.apache.solr.core.StandardDirectoryFactory.exists(StandardDirectoryFactory.java:92)
      	at org.apache.solr.core.SolrCore.getIndexSize(SolrCore.java:462)
      	at org.apache.solr.core.SolrCore.lambda$initializeMetrics$8(SolrCore.java:1200)
      	at org.apache.solr.metrics.SolrMetricManager$GaugeWrapper.getValue(SolrMetricManager.java:711)
      	at org.apache.solr.util.stats.MetricUtils.convertGauge(MetricUtils.java:488)
      	at org.apache.solr.util.stats.MetricUtils.convertMetric(MetricUtils.java:274)
      	at org.apache.solr.util.stats.MetricUtils.lambda$toMaps$4(MetricUtils.java:213)
      

      The problem comes from an IOException from list, which gets turned into a null return. In this case, we do want the IOException to bubble so that we can catch and log in getIndexSize.

      Aside from that, if all we really care about is whether there are files, then we could do a much more efficient check than requiring the whole directory to be listed. This is especially problematic when the directory is large or remote.

      Attachments

        Issue Links

          Activity

            People

              mdrob Mike Drob
              mdrob Mike Drob
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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