Solr
  1. Solr
  2. SOLR-7084

FreeTextSuggester Nullpointer when building dictionary

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.10.2
    • Fix Version/s: 5.1, 6.0
    • Component/s: Suggester
    • Labels:
      None

      Description

      Using FreeTextSuggester. When starting Solr or reloading core, all suggest requests will fail due to a Nullpointer. There is a HTTP 500 response code with the following body. Note that the error returned does not have a msg section but only a trace:

      {
        "error":{
          "trace":"java.lang.NullPointerException\n\tat org.apache.lucene.search.suggest.analyzing.FreeTextSuggester.lookup(FreeTextSuggester.java:542)\n\tat org.apache.lucene.search.suggest.analyzing.FreeTextSuggester.lookup(FreeTextSuggester.java:440)\n\tat org.apache.lucene.search.suggest.analyzing.FreeTextSuggester.lookup(FreeTextSuggester.java:429)\n\tat org.apache.solr.spelling.suggest.SolrSuggester.getSuggestions(SolrSuggester.java:199)\n\tat 
      ...
      

      Offending line:

            BytesReader bytesReader = fst.getBytesReader();
      

      The fst is null at this time.

      1. SOLR-7084.patch
        1 kB
        Jan Høydahl

        Activity

        Hide
        Jan Høydahl added a comment -

        Just throwing an exception is not very elegant. We could mask the exception and return empty list without further notice but that would render the API inconsistent. Here are two options:
        A) Fail the whole request with temporary error code (e.g. 503 Service Unavailable)
        B) Fail only the request for this dictionary, returning empty list and an error code (SuggesterResult)

        I'm tempted to suggest A here for the sake of simplicity. If requesting multiple dictionaries in one request, you'll not get a response before all dictionaries are available and working.

        Show
        Jan Høydahl added a comment - Just throwing an exception is not very elegant. We could mask the exception and return empty list without further notice but that would render the API inconsistent. Here are two options: A) Fail the whole request with temporary error code (e.g. 503 Service Unavailable) B) Fail only the request for this dictionary, returning empty list and an error code (SuggesterResult) I'm tempted to suggest A here for the sake of simplicity. If requesting multiple dictionaries in one request, you'll not get a response before all dictionaries are available and working.
        Hide
        Jan Høydahl added a comment -

        This may not be as severe as I first thought, as the JSON response is well formed, containing an error element and no msg node explaining why. A more direct handling of the situation where fst==null with a proper msg code would be good. Perhaps also SERVICE_NOT_AVAILABLE is better than the current 500 server error.

        Show
        Jan Høydahl added a comment - This may not be as severe as I first thought, as the JSON response is well formed, containing an error element and no msg node explaining why. A more direct handling of the situation where fst==null with a proper msg code would be good. Perhaps also SERVICE_NOT_AVAILABLE is better than the current 500 server error.
        Hide
        Jan Høydahl added a comment -

        Attaching simplistic patch avoiding the nullpointer and instead throwing IllegalStateException

        Show
        Jan Høydahl added a comment - Attaching simplistic patch avoiding the nullpointer and instead throwing IllegalStateException
        Hide
        ASF subversion and git services added a comment -

        Commit 1659197 from janhoy@apache.org in branch 'dev/trunk'
        [ https://svn.apache.org/r1659197 ]

        SOLR-7084: FreeTextSuggester Nullpointer when building dictionary

        Show
        ASF subversion and git services added a comment - Commit 1659197 from janhoy@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1659197 ] SOLR-7084 : FreeTextSuggester Nullpointer when building dictionary
        Hide
        ASF subversion and git services added a comment -

        Commit 1659225 from janhoy@apache.org in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1659225 ]

        SOLR-7084: FreeTextSuggester Nullpointer when building dictionary (merge from trunk)

        Show
        ASF subversion and git services added a comment - Commit 1659225 from janhoy@apache.org in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1659225 ] SOLR-7084 : FreeTextSuggester Nullpointer when building dictionary (merge from trunk)
        Hide
        Timothy Potter added a comment -

        Bulk close after 5.1 release

        Show
        Timothy Potter added a comment - Bulk close after 5.1 release

          People

          • Assignee:
            Jan Høydahl
            Reporter:
            Jan Høydahl
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development