-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
STORM-3048 : A Potential NPE #2657
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.
+1
The changes are strictly not needed, because the code only runs to verify that a scheduling is correct, so if there is no scheduling at all, which is the case for the NPE, then something really really bad has happened. But because these are in the context of a test the asserts are fine.
@@ -98,6 +98,7 @@ public static boolean validateSolution(Cluster cluster, TopologyDetails td) { | |||
*/ | |||
private static boolean checkConstraintsSatisfied(Cluster cluster, TopologyDetails topo) { | |||
LOG.info("Checking constraints..."); | |||
assert(cluster.getAssignmentById(topo.getId())!=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.
nit: space before and after !=
. same for the below code changes.
I am getting a failure now of
Specifically
|
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.
+1
We have developed a static analysis tool NPEDetector to find some potential NPE. Our analysis shows that some callees may return null in corner case(e.g. node crash , IO exception), some of their callers have !=null check but some do not have.
Bug:
Cluster#getAssignmentById has 20 callers, 18 callers have null checker like this:
the caller have no null checker :ConstraintSolverStrategy#checkSpreadSchedulingValid ConstraintSolverStrategy#checkConstraintsSatisfied.
I was feel uncertain about whether add null checker here, so i only add assert. If this bug are false positive, please tell me.