SOLR-18318: Fix NPE in GetNodeSystemInfo when nodes param is set - #4661
Conversation
|
triggered CI. any chance you can look at the comment as well?? Be nice to know. |
|
Thanks for the suggestion. I’ll take a look at the |
|
looks like some precommit faiolures... I believe since this is a bugfix we need a changelog too. |
Thanks for pointing this out. I looked into the usage of remoteNodeData. The proxied response that we add in GetNodeSystemInfo is indeed a NodeSystemResponse, so I checked whether we could tighten the type to Map<String, NodeSystemResponse>. However, remoteNodeData is also populated through @JsonAnySetter, where Jackson provides dynamic fields with Object values. Changing the type would require changing the @JsonAnySetter handling as well, and it could affect the current JSON serialization/deserialization behavior of this response model. Since this PR is focused on fixing the NPE caused by remoteNodeData being uninitialized, I have kept the existing Object type and only initialized the map with a LinkedHashMap so proxied node responses can be safely stored. Thanks again for the suggestion. |
|
please review |
|
Spotless formatting fixes and pushed the updated commit. Waiting for CI results. |
|
Okay, I've manually tested the fix, looks great! Since I can't push to your branch, can you update the TODO comment with the suggested text, and then I'll merge? |
Updated the TODO comment as suggested. Kept the type as Thanks for the review! |
|
Thanks for this! |
Thanks @epugh for the review and guidance! Appreciate you taking the time to look into this. |
|
if you are looking for other places to contribute... Please either look at the list of CLI tools that we want to migrate to Picocli: #3254 or you can look at the list of tasks related to migrating APIs to V2: https://issues.apache.org/jira/browse/SOLR-15781. Also worth joining the dev@solr.apache.org mailing list. |
Thanks for the suggestions! I'll definitely look into these areas and pick up another issue to contribute. I'll also join the dev@solr.apache.org mailing list to stay updated with the community discussions. Thanks again for the guidance! |
|
This should not have passed the precommit check. |
|
Looking at the Checks tab, precommit was in a failed state. Did you see it @epugh? We ought to gate PR merging on that particular check. There was another PR you merged a couple days ago that failed similarly -- it was a tidy issue in that case. |
@dsmiley Thanks for pointing this out. Just to clarify, the missing ASF license header was noticed after the initial CI run, and I added it along with the formatting fixes before the final merge. I'll make sure to check the full precommit/RAT results more carefully in future contributions so these issues are caught earlier. |
(cherry picked from commit 8409834)
Description
Fixes an issue where the v2
/api/node/systemendpoint throws aNullPointerExceptionwhen thenodesparameter is provided in SolrCloud mode.The issue occurs when
GetNodeSystemInfoproxies requests to other nodes and tries to store the proxied responses inNodeSystemResponse.remoteNodeData. SinceremoteNodeDatawas not initialized, adding node responses caused an NPE and returned an HTTP 500 error instead of the expected aggregated node information.Solution
Initialized
NodeSystemResponse.remoteNodeDatawith aLinkedHashMapso that proxied node responses can be safely stored.Added a new SolrCloud test
GetNodeSystemInfoSolrCloudTestthat covers the failing scenario by requesting node system information with thenodesparameter and verifies that the response contains the expected node data.Tests
Ran: