You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/08/03 11:53:17 UTC

[GitHub] [dubbo] zhaoyangyingmu opened a new issue, #10403: NullPointerException could be Thrown at line 124 of org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalance

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: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zhaoyangyingmu closed issue #10403: NullPointerException could be Thrown at line 124 of org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalance

Posted by GitBox <gi...@apache.org>.
zhaoyangyingmu closed issue #10403: NullPointerException could be Thrown at line 124 of org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalance
URL: https://github.com/apache/dubbo/issues/10403


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on issue #10403: NullPointerException could be Thrown at line 124 of org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalance

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on issue #10403:
URL: https://github.com/apache/dubbo/issues/10403#issuecomment-1204712341

   ![image](https://user-images.githubusercontent.com/9292748/182756373-a02fee2e-75a9-4e95-8cfe-16932590bd96.png)
   `selectedWRR` and `selectedInvoker` are being set in the same time. It is impossible that `selectedWRR` is null and `selectedInvoker` is not null.


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org