Michael McCandless created LUCENE-4948:
------------------------------------------

             Summary: Stink bug in PostingsHighlighter
                 Key: LUCENE-4948
                 URL: https://issues.apache.org/jira/browse/LUCENE-4948
             Project: Lucene - Core
          Issue Type: Bug
          Components: modules/highlighter
            Reporter: Michael McCandless
             Fix For: 5.0, 4.4


This test fail reproduces on IBM J9:

{noformat}
NOTE: reproduce with: ant test  -Dtestcase=TestPostingsHighlighter 
-Dtests.method=testCambridgeMA -Dtests.seed=2A9A93DAC39E0938 
-Dtests.multiplier=3 -Dtests.slow=true -Dtests.locale=es_HN 
-Dtests.timezone=America/Yellowknife -Dtests.file.encoding=UTF-8
{noformat}


{noformat}
Stack Trace:
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 37
        at 
__randomizedtesting.SeedInfo.seed([2A9A93DAC39E0938:AB8FF071AD305139]:0)
        at 
org.apache.lucene.search.postingshighlight.Passage.addMatch(Passage.java:53)
        at 
org.apache.lucene.search.postingshighlight.PostingsHighlighter.highlightDoc(PostingsHighlighter.java:547)
        at 
org.apache.lucene.search.postingshighlight.PostingsHighlighter.highlightField(PostingsHighlighter.java:425)
        at 
org.apache.lucene.search.postingshighlight.PostingsHighlighter.highlightFields(PostingsHighlighter.java:364)
        at 
org.apache.lucene.search.postingshighlight.PostingsHighlighter.highlightFields(PostingsHighlighter.java:268)
        at 
org.apache.lucene.search.postingshighlight.PostingsHighlighter.highlight(PostingsHighlighter.java:198)
        at 
org.apache.lucene.search.postingshighlight.TestPostingsHighlighter.testCambridgeMA(TestPostingsHighlighter.java:373)
{noformat}

I think it's because J9 grows arrays in a different progression than other JVMs 
... we should fix PostingsHighlighter to forcefully grow the arrays to the same 
length instead of this:

{noformat}
    if (numMatches == matchStarts.length) {
      matchStarts = ArrayUtil.grow(matchStarts, numMatches+1);
      matchEnds = ArrayUtil.grow(matchEnds, numMatches+1);
      BytesRef newMatchTerms[] = new BytesRef[ArrayUtil.oversize(numMatches+1, 
RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
      System.arraycopy(matchTerms, 0, newMatchTerms, 0, numMatches);
      matchTerms = newMatchTerms;
    }
{noformat}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to