Comments (11)
对问题2,我发现在spring的war使用
`
@configuration
public class DubboConfig {
@PreDestroy
public void shutdownDestroy() {
ProtocolConfig.destroyAll();
}
}
`
可以避免DubboShutdownHook的异常
from dubbo.
我也是这种情况 。求解答
from dubbo.
在没使用dubbo的应用里也会有这个错误,dubbo的相关错误我理解是,tomcat已经在做class的卸载,但dubbo还在向注册中心发送注销请求,所以报错了。
from dubbo.
我也遇到相同的问题'求解答
from dubbo.
第一堆异常 是软件包没有优雅释放资源导致的,不影响,很多包都有这样的问题,odbc驱动包也会这样,
比如 创建了一个无法正常停止的线程,没有主动销毁,但这些都不影响,其实是可以减少的,dubbo里面有很多没有去释放的资源,参考https://github.com/alibaba/dubbo/pull/102/files。
第二堆异常是销毁顺序问题,采用shutdownhook去销毁不能保证正确的销毁顺序,我们这边目前的做法是停机前主动先去销毁dubbo的, DubboShutdownHook应该主要是提供在standalone方式运行dubbo的时候,去实现优雅停机的,但是如果是使用外部容器的方式DubboShutdownHook就不合适了,销毁应该交给容器的停止的监听去触发,否则就会出现这种顺序不对导致的问题
from dubbo.
@wuwen5 HI,朋友。第二堆异常的需要做哪些修改,能提供下具体代码吗? 如果在容器中运行dubbo,是否要禁用dubbo的DubboShutdownHook
from dubbo.
等待着高手解答
from dubbo.
@yungoo 这种在关闭tomcat时候,可以让dubbo优雅停机吗
from dubbo.
Related issue #1665
from dubbo.
@ralf0131 今晚我们在生产环境也遇到了作者说的第二个异常
问题描述
Dubbo应用在关闭时报NoClassDefFoundError: com/alibaba/dubbo/registry/support/SkipFailbackWrapperException
。
完整的异常调用栈如下:
2018-05-10 20:30:10,597 WARN [DubboShutdownHook] c.a.d.r.z.ZookeeperRegistry - [] [] [] [DUBBO] Failed to unregister url consumer://xxx.xxx.xxx.xxx/com.wacai.ucenter.service.NicknameValidatable?application=ucenter-query&category=consumers&check=false&default.check=false&default.retries=0&default.timeout=5000&dubbo=3.1.1&init=true&interface=com.wacai.ucenter.service.NicknameValidatable&methods=queryAudit,moveNicknameCache,validateAndUid,validateAndType,validate&owner=xxx&pid=27285&revision=1.7.0&side=consumer×tamp=1525801075589 to registry zookeeper://xxx:12181/com.alibaba.dubbo.registry.RegistryService?application=ucenter-query&backup=xxx&client=zkclient&dubbo=3.1.1&group=dubbo_product&interface=com.alibaba.dubbo.registry.RegistryService&owner=xxx&pid=27285×tamp=1525801075625 on destroy, cause: com/alibaba/dubbo/registry/support/SkipFailbackWrapperException, dubbo version: 3.1.1, current host: xxx.xxx.xxx.xxx
java.lang.NoClassDefFoundError: com/alibaba/dubbo/registry/support/SkipFailbackWrapperException
at com.alibaba.dubbo.registry.support.FailbackRegistry.unregister(FailbackRegistry.java:168)
at com.alibaba.dubbo.registry.support.AbstractRegistry.destroy(AbstractRegistry.java:492)
at com.alibaba.dubbo.registry.support.FailbackRegistry.destroy(FailbackRegistry.java:436)
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.destroy(ZookeeperRegistry.java:90)
at com.alibaba.dubbo.registry.support.AbstractRegistryFactory.destroyAll(AbstractRegistryFactory.java:70)
at com.alibaba.dubbo.config.ProtocolConfig.destroyAll(ProtocolConfig.java:429)
at com.alibaba.dubbo.config.AbstractConfig$1.run(AbstractConfig.java:452)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.alibaba.dubbo.registry.support.SkipFailbackWrapperException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 8 common frames omitted
问题分析
根据异常日志,异常是从FailbackRegistry
抛出来的,最后一个Caused by
说是SkipFailbackWrapperException 类未找到
,实际上类是存在的,说明是其他原因引起。
异常发生在FailbackRegistry.unregister(FailbackRegistry.java:168)
,和作者遇到的异常代码是同一行,对应的源代码:
从源代码看很清晰,FailbackRegistry.unregister(url)
在执行doUnregister(url)
时抛出了异常,但在执行t instanceof SkipFailbackWrapperException
时又抛出了ClassNotFoundException异常,结果实际的异常被弄丢了,导致发现不了问题根源。
解决方案
对t instanceof SkipFailbackWrapperException
语句进行异常捕获,以便打印实际的异常日志。
boolean skipFailback = false;
try {
skipFailback = t instanceof SkipFailbackWrapperException;
} catch (Throwable t1) {
logger.error("Failed to unregister " + url + ", waiting for retry, cause: " + t.getMessage(), t);
logger.error("Unregister url occur unexpected error, cause: " + t1.getMessage(), t1);
}
from dubbo.
This is because tomcat has been stopped but some of the threads Dubbo created did not stopped correctly.
Previously Dubbo uses ShutdownHook to stop these threads, but when tomcat is stops the web application, Dubbo's ShutdownHook has not been executed yet.
The solution is to ensure Dubbo listens to web application's lifecycle and stops the threads properly.
This issue should be fixed from 2.6.3 onwards.
from dubbo.
Related Issues (20)
- [Bug] docker dubbo cluster broadcast not working HOT 2
- [Bug] Non-idempotent unit tests (follow-up of #14134)
- [Bug] In the example dubco-samples-spring-boot-trace-skywalking, the run fails HOT 2
- No provider available from registry RegistryDirectory(registry: 127.0.0.1:8848) HOT 1
- Dubbo 3.2 throws an error directly upon startup HOT 4
- [Bug] override url with configurator from "service-name.configurators" in interface mode not as expected HOT 11
- The matching wildcard is strict, but no declaration can be found for element 'dubbo:consumer'. HOT 1
- [Bug] enable-empty-protection default value is different between doc and code HOT 2
- [Bug] [Serialization Security] Serialized class java.lang.ArithmeticException is not in allow list. HOT 6
- [Bug] dubbo Provider列表变更通知consumer 消费端 出现NullPointerException bug HOT 1
- [Bug] java.lang.IllegalArgumentException: interface org.apache.dubbo.rpc.service.EchoService is not visible from class loader HOT 1
- [Bug] The registry uses etcd, but javaagent skywalking fails to start HOT 6
- [Bug] there are problems if mapping key only has service interface class name
- [Bug] level too large 2048 problem during serialization data by fastjson2 HOT 1
- No such extension org.apache.dubbo.rpc.Filter HOT 1
- [Bug] HOT 2
- [Bug] setting dubbo.application.metadata-type at config center does not take effect HOT 2
- [Bug] security/serialize.allowlist overwrite by dubbo framework HOT 9
- [Bug] The configuration dubbo services does not take effect in the configuration file and the service is not registered HOT 16
- 实现一个客户端自适应负载均衡算法-SelfAdaptionLoadBablance HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dubbo.