This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.3 by this push:
new a61de782c1 feat: fix old listener destroy but not remove lead to new
same app url subscribe fail (#14669)
a61de782c1 is described below
commit a61de782c1e1b4a1387790e249c18849d95145c6
Author: xingci <[email protected]>
AuthorDate: Wed Oct 9 14:59:04 2024 +0800
feat: fix old listener destroy but not remove lead to new same app url
subscribe fail (#14669)
When url A and B mapping to appA in mapping cache file, but A is mapping to
appA and appB in remote.
A subscribe first, put appA instance listener. but onEvent change to appA
and appB mapping.
Then destroy appA instance listener, but not remove.
And then B subscribe, on account of old instance listener not remove, it's
subscribe failed.
Co-authored-by: haifeng.pang <[email protected]>
---
.../java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java | 1 +
1 file changed, 1 insertion(+)
diff --git
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
index b86afee87d..b2ded47895 100644
---
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
+++
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
@@ -456,6 +456,7 @@ public class ServiceDiscoveryRegistry extends
FailbackRegistry {
oldListener.removeListener(url.getServiceKey(), listener);
if (!oldListener.hasListeners()) {
oldListener.destroy();
+ serviceListeners.remove(appKey);
removeAppSubscriptionLock(appKey);
}
} finally {