-
Couldn't load subscription status.
- Fork 337
Catches the null pointer exception that occurs when sorting fields on geo point. #5504
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
Conversation
Signed-off-by: Anthony Leong <aj.leong623@gmail.com>
…5494) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Anthony Leong <aj.leong623@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Craig Perkins <cwperx@amazon.com> Signed-off-by: Anthony Leong <aj.leong623@gmail.com>
…rch-project#5495) Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Shikhar Jain <8859327+shikharj05@users.noreply.github.com> Signed-off-by: Anthony Leong <aj.leong623@gmail.com>
Signed-off-by: Finn Carroll <carrofin@amazon.com> Signed-off-by: Anthony Leong <aj.leong623@gmail.com>
|
Thank you for the deep dive and PR @ajleong623 ! It would be great to have an automated test to validate the fix. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5504 +/- ##
==========================================
- Coverage 72.76% 72.73% -0.04%
==========================================
Files 397 397
Lines 24591 24591
Branches 3741 3741
==========================================
- Hits 17894 17886 -8
- Misses 4867 4873 +6
- Partials 1830 1832 +2
🚀 New features to boost your workflow:
|
|
@nibix I think those unrelated commits might be from trying to merge the changes from the main into my own repository since my repository was a bit out of date. I can change those back so that only the null pointer catch is included. Also, I would have to create an integration test with the security plugin configured to reproduce the error. |
This repo is already equipped for that. Take a look at FlsFlmIntegrationTest as an example. You can run the whole suite with |
|
@ajleong623 can you check the failing tests? There may need to be some additional null handling from the callers of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajleong623 The change looks good. Mind adding automated tests to validate the fix?
|
@cwperks Thank you for the example. It looks like it has all the methods I would need to reproduce the error. |
|
@cwperks On second look, it seems like there is already a |
Signed-off-by: Anthony Leong <aj.leong623@gmail.com>
Signed-off-by: Anthony Leong <aj.leong623@gmail.com>
|
@cwperks It seems like the tests that failed worked on my end, so I reran them. |
They may have been flaky (though the tests in this repo are quite stable). I just approved the checks to run again. Yes you can create a separate test suite with its own test data. Use the suite above as an example which shows setup and teardown of an inmemory cluster (LocalCluster), creating indices, creating users with roles mappings, ingesting data and querying. |
|
@ajleong623 Can we also add a null check in here? |
Signed-off-by: Anthony Leong <aj.leong623@gmail.com>
|
For some reason, after my new test, I am not sure if the point is hit. There was an additional step when I reproduced the issue locally of logging into the node and going through the ssl configurations. I will look into replicating that process later on. |
|
Thank you for creating the test!
Could you ever get ahold of a full stack trace of the NullPointerException? To be honest, for me it is surprising that |
The was from following the steps in this video https://www.youtube.com/watch?v=G8ADRRF4IPQ, then creating an index with a mapping of Then create a document with Finally search with a post request with body |
|
Thank you @ajleong623 , that stacktrace is very helpful! I am wondering whether this is actually a bug in the This code passes
I would presume However, looking at the code above, we see that only This would mean that I have not tried so far to deeply understand the code of So, is this possibly a bug in core? |
|
@nibix Yes. That makes a lot of sense. I can make the request and try stepping through the geo point sort builder to see when it calls |
|
@nibix I have linked a pull request in core opensearch-project/OpenSearch#18843. I did a brief trial run by setting up the OpenSearch request as described when reducing the stack trace, and the outputs seem valid. |
|
I don't think this issue is limited to geopoint. See: opensearch-project/OpenSearch-Dashboards#9873 |
|
@nibix FYI when |
|
@cwperks it looks like the request flow also went through ExitableLeafReader which is an entry point into the security plugin. I think that’s based there should be a null checker whenever a field ends up being validated in the plugin. I will make a separate issue for those cases. Or would it be easier to add the check in security? |

Description
This fixes the bug where a null pointer exception occurs when a sort is run on geo point fields.
Issues Resolved
#5503
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.