zhaoyangyingmu opened a new issue, #10403:
URL: https://github.com/apache/dubbo/issues/10403

   <!-- If you need to report a security issue please visit 
https://github.com/apache/dubbo/security/policy -->
   
   - [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: 3.0
   * Operating System version: Any
   * Java version: 1.8
   
   ### Steps to reproduce this issue
   An NPE could be thrown at line 124 of 
`org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalance`. `selectedWRR` 
could be null because the condition `cur > maxCurrent` may not be true. 
   ```java
       protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, 
Invocation invocation) {
           WeightedRoundRobin selectedWRR = null;
           // other codes
           for (Invoker<T> invoker : invokers) {
               // other codes
               if (cur > maxCurrent) {
                   selectedWRR = weightedRoundRobin;
               }
           }
           if (selectedInvoker != null) {
               selectedWRR.sel(totalWeight); // selectedWRR could be null.
               return selectedInvoker;
           }
   ```
   ### Actual Behavior
   An NPE could be thrown at line 124 because no defensive null check is 
provided.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to