Mailing List Archive

TopHits.scoreDocs is not final
We encountered a very rare strange bug (looks like it must be a JVM
bug) where we have a Scorer.docid() method like this:

if (curDocIdx >= topDocs.scoreDocs.length) {
return NO_MORE_DOCS;
}
return topDocs.scoreDocs[curDocIdx].doc;

And this was very rarely, not reproducibly, but repeatedly raising
ArrayIndexOutOfBoundsException!

It made us notice that topDocs.scoreDocs is not final, which maybe
would have prevented this. Is there any reason why we would not make
this member final?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: TopHits.scoreDocs is not final [ In reply to ]
Let's make this member final!

I vaguely remember this was tried before and it was ... difficult? But I
could not find that past attempt! Maybe it was just a horrible nightmare.

Mike

On Thu, Jul 22, 2021 at 12:36 PM Michael Sokolov <msokolov@gmail.com> wrote:

> We encountered a very rare strange bug (looks like it must be a JVM
> bug) where we have a Scorer.docid() method like this:
>
> if (curDocIdx >= topDocs.scoreDocs.length) {
> return NO_MORE_DOCS;
> }
> return topDocs.scoreDocs[curDocIdx].doc;
>
> And this was very rarely, not reproducibly, but repeatedly raising
> ArrayIndexOutOfBoundsException!
>
> It made us notice that topDocs.scoreDocs is not final, which maybe
> would have prevented this. Is there any reason why we would not make
> this member final?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
> --
Mike McCandless

http://blog.mikemccandless.com