kdt523 opened a new pull request, #15345:
URL: https://github.com/apache/lucene/pull/15345

   Description
   Summary
   This fixes a bug where MaxScoreBulkScorer could set its inner/outer window 
upper bounds past the current leaf maxDoc, allowing TermScorer to be called 
with docIDs >= maxDoc and causing EOF or ArrayIndex errors when accessing norms.
   
   Motivation
   Under certain disjunction + filter workloads the bulk scorer's windowing 
logic could loop with upper bounds computed without clamping to the leaf's 
maxDoc. This could result in TermScorer attempting to read norms past the leaf 
end (NO_MORE_DOCS), leading to intermittent EOF/ArrayIndex errors in production 
and tests.
   
   What changed
   
   lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java
   Clamp outer and inner window upper bounds to the leaf maxDoc to ensure 
scoring loops never iterate past the leaf boundary.
   
lucene/core/tests/src/test/org/apache/lucene/search/TestMaxScoreBulkScorerFilterBounds.java
   Add regression test exercising the disjunction + restrictive filter code 
path that previously triggered the failure.
   lucene/CHANGES.txt
   Add an entry referencing this change (GITHUB#15324) and the contributor.
   How to test
   
   Unit tests:
   The newly-added test in lucene/core/tests reproduces the scenario; run it 
with:
   ./gradlew :lucene:core:test --tests 
org.apache.lucene.search.TestMaxScoreBulkScorerFilterBounds
   Manual validation:
   Build core and run the relevant test suite:
   ./gradlew :lucene:core:compileJava :lucene:core:test
   Note: Some generate/format tasks may require python3 available on PATH; if 
you see checksum mismatches, run:
   ./gradlew :lucene:core:generateForUtil --no-daemon --info
   after ensuring python3 is callable by Gradle.
   CHANGES entry
   
   GITHUB#15324: Fix MaxScoreBulkScorer could call TermScorer with docID >= 
maxDoc, causing EOFException on norms access (contributor: kdt523)
   Checklist (from CONTRIBUTING.md)
   
   [x] My PR title is short and descriptive.
   [x] I have included a summary of the change and why it was needed.
   [x] I added tests that reproduce the issue and prove the fix.
   [x] I updated CHANGES.txt with an entry referencing the PR/issue.
   [x] I ran ./gradlew tidy and applied code formatting.
    I ran ./gradlew check locally and all checks pass.
    If the change affects generated sources, I ran the generator tasks and 
included updated files.
    task done are marked with [x]
    fix: #15324 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to