-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Negative Search Stats #16598
Comments
The OpenSearch/server/src/main/java/org/opensearch/action/search/SearchRequestStats.java Line 82 in e688388
and on phase failure: OpenSearch/server/src/main/java/org/opensearch/action/search/SearchRequestStats.java Line 89 in e688388
I looked through and didn't find any cases where they might both be called. However, I did notice that OpenSearch/server/src/main/java/org/opensearch/index/search/stats/SearchStats.java Line 120 in e688388
And the key is just the phase name, which are common strings: OpenSearch/server/src/main/java/org/opensearch/action/search/SearchPhaseName.java Lines 19 to 25 in e688388
But digging in to the increments and decrements they use atomic operations so that shouldn't be an issue... |
Describe the bug
We have identified a bug where search statistics are being incorrectly reported as negative, which is causing failures when accessing the
nodes/stats
API. This issue is specifically related to the handling of negative values in theSearchStats
class. The exception occurs when the API attempts to serialize the statistics, causing ajava.lang.IllegalStateException
due to the use ofVLong
encoding, which does not support negative values.Example Response from nodes/stats API:
Exception in
elasticsearch.log
:Root Cause
The issue occurs due to the use of
StreamOutput.writeVLong()
in theSearchStats
class, which does not support negative long values. The stack trace shows that when a negative value is encountered, it triggers the exception inelasticsearch.log
shown above.The problematic line in the code is:
Source: SearchStats.java#L89
Related component
Search
To Reproduce
This bug does not occur consistently across all domains or search queries. We are still investigating the specific conditions or types of searches that trigger this issue.
Expected behavior
Search stats should not be negative.
Additional Details
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: