[ 
https://issues.apache.org/jira/browse/STORM-3050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

lujie closed STORM-3050.
------------------------
    Resolution: Fixed

> a potential NPE in ConstraintSolverStrategy#checkResourcesCorrect
> -----------------------------------------------------------------
>
>                 Key: STORM-3050
>                 URL: https://issues.apache.org/jira/browse/STORM-3050
>             Project: Apache Storm
>          Issue Type: Bug
>            Reporter: lujie
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> We have developed a static analysis tool 
> [NPEDetector|https://github.com/lujiefsi/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:*
> callee TopologyDetails#getTotalCpuReqTask have two callers, one of them have 
> null checker:
> {code:java}
> public double getTotalRequestedCpu() {
> double totalCpu = 0.0;
> for (ExecutorDetails exec : this.getExecutors()) {
> Double execCpu = getTotalCpuReqTask(exec);
> if (execCpu != null) {
> totalCpu += execCpu;
> }
> }
> return totalCpu;
> }
> {code}
> but ConstraintSolverStrategy#checkResourcesCorrect have no checker:
> {code:java}
> for (ExecutorDetails executor : entry.getValue()) {
> supervisorUsedCpu += topology.getTotalCpuReqTask(executor);
> }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to