-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-6282] Add null check condition #5026
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
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.
As I understand it, groupId should never be null under normal conditions, but it might become null in abnormal cases. Is there a way to reproduce such a scenario in tests?
|
|
||
| ManagedInterpreterGroup getInterpreterGroup(String groupId) { | ||
| if (groupId == null) { | ||
| return null; |
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.
Could you add a warn log before returning in the null check so that this situation is more visible?
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.
Returning null could cause an NPE in the code currently calling this method (e.g., SessionConfInterpreter:53).
Therefore, I think it would be better to either not return null when groupId is null, or to modify the part that uses this method.
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.
I agree with your point, and I’d like to ask for a code update.
I found that ManagedInterpreterGroup getInterpreterGroup(String groupId) is used in two places: line 386 of InterpreterSettingManager.java and line 53 of SessionConfInterpreter.java.
In InterpreterSettingManager.java, null is already handled properly, but in SessionConfInterpreter.java it is not. Could you please update the code to handle null in that part as well?
|
@ParkGyeongTae Thanks for review.
If you set it up as above and run the recovery test, it seems that a problem occurs where the groupId is set to null in the interpreter setting section when restarting the server. |
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.
I was able to reproduce this issue, and I confirmed that the changes fix the problem.
### What is this PR for? This PR was created to prevent an error that occurs in the `InterpreterSetting.getInterpreterGroup` method when `groupId` is null and is retrieved from the Set. Normally, the groupId parameter does not seem to be passed as null. I found it when tested service shutdown(#4965). ### What type of PR is it? Improvement ### Todos * [x] - Add null check condition ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-6282 ### How should this be tested? ### Screenshots (if appropriate) ### Questions: * Does the license files need to update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Closes #5026 from proceane/feature/ZEPPELIN-6282. Signed-off-by: ParkGyeongTae <[email protected]> (cherry picked from commit 078b754) Signed-off-by: ParkGyeongTae <[email protected]>
|
Merged into |
What is this PR for?
This PR was created to prevent an error that occurs in the
InterpreterSetting.getInterpreterGroupmethod whengroupIdis null and is retrieved from the Set.Normally, the groupId parameter does not seem to be passed as null.
I found it when tested service shutdown(#4965).
What type of PR is it?
Improvement
Todos
What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-6282
How should this be tested?
Screenshots (if appropriate)
Questions: