You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "FancyKong (GitHub)" <gi...@apache.org> on 2019/01/28 08:18:31 UTC
[GitHub] [incubator-dubbo] FancyKong opened issue #3369: 泛化调用生成的ReferConfig,在服务提供者异常的时候调用destory并不能释放zk链接等资源
复现步骤:
1. 将服务提供者全部实例禁用
2. 触发该服务提供者的链接建立
3. 建立失败
4. 尝试回收该链接的资源
5. 回收失败
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3369 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] FancyKong commented on issue #3369: 泛化调用生成的ReferenceConfig,在服务提供者异常的时候调用destory并不能释放zk链接等资源
Posted by "FancyKong (GitHub)" <gi...@apache.org>.
我通过debug 发现,因为没有任何服务提供者,所以 ReferenceConfig 对象get的时候会有异常,所以GenericService是null。
但其实链接的资源已经建立了,这个时候去回收这个ReferenceConfig 对象,回收不了。
猜测可能是GenericService ref 本身就等于null,但是invoker 却因此而没有被回收
public synchronized void destroy() {
if (ref == null) {
return;
}
if (destroyed) {
return;
}
destroyed = true;
try {
invoker.destroy();
} catch (Throwable t) {
logger.warn("Unexpected err when destroy invoker of ReferenceConfig(" + url + ").", t);
}
invoker = null;
ref = null;
}
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3369 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] FancyKong commented on issue #3369: 泛化调用生成的ReferenceConfig,在服务提供者异常的时候调用destory并不能释放zk链接等资源
Posted by "FancyKong (GitHub)" <gi...@apache.org>.
/**
* 连接消费服务
*
* @param config
* @return
*/
public GenericService genericService(GenericServiceConfig config) {
ReferenceConfig<GenericService> referenceConfig = buildReferenceConfig(config);
GenericService genericService = getServiceFromCache(referenceConfig);
if (genericService != null) {
return genericService;
} else {
log.info("该config对应的泛化服务不存在, config = {}", config);
closeConsumer(config);
return null;
}
}
/**
* 关闭消费某个服务
*
* @param config 泛化服务配置
*/
public void closeConsumer(GenericServiceConfig config) {
ReferenceConfigCache cache = ReferenceConfigCache.getCache();
cache.destroy(buildReferenceConfig(config));
}
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3369 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org