Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-10292

AnalyzingInfixSuggester thread safety: lookup() fails during (re)build()

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 10.0 (main), 9.2
    • None
    • None
    • New

    Description

      I'm filing this based on anecdotal information from a Solr user w/o experiencing it first hand (and I don't have a test case to demonstrate it) but based on a reading of the code the underlying problem seems self evident...

      With all other Lookup implementations I've examined, it is possible to call lookup() regardless of whether another thread is concurrently calling build() – in all cases I've seen, it is even possible to call lookup() even if build() has never been called: the result is just an "empty" List<LookupResult>

      Typically this is works because the build() method uses temporary datastructures until it's "build logic" is complete, at which point it atomically replaces the datastructures used by the lookup() method.   In the case of AnalyzingInfixSuggester however, the build() method starts by closing & null'ing out the protected SearcherManager searcherMgr (which it only populates again once it's completed building up it's index) and then the lookup method starts with...

          if (searcherMgr == null) {
            throw new IllegalStateException("suggester was not built");
          }
      

      ... meaning it is unsafe to call AnalyzingInfixSuggester.lookup() in any situation where another thread may be calling AnalyzingInfixSuggester.build()

      Attachments

        1. LUCENE-10292.patch
          9 kB
          Chris M. Hostetter
        2. LUCENE-10292-1.patch
          11 kB
          Chris M. Hostetter
        3. LUCENE-10292-2.patch
          28 kB
          Chris M. Hostetter
        4. LUCENE-10292-3.patch
          28 kB
          Chris M. Hostetter

        Activity

          People

            hossman Chris M. Hostetter
            hossman Chris M. Hostetter
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: