This is an automated email from the ASF dual-hosted git repository.

yizhenqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new 8d06e5e  fix https://github.com/apache/dubbo/issues/6444 NPE (#6793)
8d06e5e is described below

commit 8d06e5e91604d3cfbd721d1f7b414fa53f0f2eb8
Author: yizhenqiang <[email protected]>
AuthorDate: Tue Oct 13 11:20:34 2020 +0800

    fix https://github.com/apache/dubbo/issues/6444 NPE (#6793)
    
    * fix https://github.com/apache/dubbo/issues/6444 NPE
    
    * agin ci
    
    * del DubboProtocol#getSharedClient locks.remove(key)
---
 .../java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
 
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
index 791df67..a794863 100644
--- 
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
+++ 
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
@@ -221,6 +221,7 @@ public class DubboProtocol extends AbstractProtocol {
         return INSTANCE;
     }
 
+    @Override
     public Collection<Exporter<?>> getExporters() {
         return Collections.unmodifiableCollection(exporterMap.values());
     }
@@ -458,7 +459,7 @@ public class DubboProtocol extends AbstractProtocol {
         locks.putIfAbsent(key, new Object());
         synchronized (locks.get(key)) {
             clients = referenceClientMap.get(key);
-            // dubbo check
+            // double check
             if (checkClientCanUse(clients)) {
                 batchClientRefIncr(clients);
                 return clients;
@@ -488,8 +489,10 @@ public class DubboProtocol extends AbstractProtocol {
             /*
              * I understand that the purpose of the remove operation here is 
to avoid the expired url key
              * always occupying this memory space.
+             * But "locks.remove(key);" can lead to "synchronized 
(locks.get(key)) {" NPE, considering that the key of locks is "IP + port",
+             * it will not lead to the expansion of "locks" in theory, so I 
will annotate it here.
              */
-            locks.remove(key);
+//            locks.remove(key);
 
             return clients;
         }

Reply via email to