您的位置:首页 > 运维架构 > Tomcat

rocketmq 使用netty,停止时报错

2017-03-21 00:00 543 查看
摘要: The web application [] created a ThreadLocal with key of type ,but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

线上项目发布时,发现tomcat出现如图所示日志,于是想找到出现这个日志的原因。



通过google搜索日志内容,发现相关的结果很少,其中有两个比较靠谱
1)https://github.com/netty/netty/issues/2084
2)https://github.com/relayrides/pushy/issues/29

通过以上两个帖子,初步分析原因:项目依赖了rocketmq,rockmq依赖了netty,tomcat停止时,由于mq的event executor由于是异步销毁的,所以出现了第一个图中的日志。如果需要消除日志,可以在销毁时延时1秒来解决。
日志中的报错可以忽略,不会有影响。

消除报错日志测试
在项目中重写了rocketmq的类NettyRemotingClient,在shutdown方法的最后加上sleep 1s做测试,停止tomcat,发现原来存在的报错不见了。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  RocketMQ Netty Tomcat Java