Open 89333367 opened 7 years ago
感谢反馈。问题的原因见https://github.com/weibocom/motan/issues/79 我们准备通过ShutdownHook的方式fix这个问题,近期会发布一个小版本,请关注。
有相关的分支吗?
@rayzhang0603 大神
@yanminmin 现在还没有,尽量下周提交一个分支
多谢,非常期待.能透露下解决方案吗?
@yanminmin @89333367 motan0.3.1版本已提供了com.weibo.api.motan.closable.ShutDownHookListener,在web.xml中添加ShutDownHookListener即可
加上了,这样加的,但是还是报错,而且tomcat没有关掉,还是要kill
<listener>
<listener-class>com.weibo.api.motan.closable.ShutDownHookListener</listener-class>
</listener>
13-Jul-2017 11:25:01.341 严重 [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [uml-web-api-bigdata-impl] created a ThreadLocal with key of type [com.weibo.api.motan.cluster.ha.FailoverHaStrategy$1] (value [com.weibo.api.motan.cluster.ha.FailoverHaStrategy$1@23a56183]) and a value of type [java.util.ArrayList] (value [[com.weibo.api.motan.protocol.rpc.DefaultRpcProtocol$DefaultRpcReferer@36e8d839]]) 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.
13-Jul-2017 11:25:01.341 严重 [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [uml-web-api-bigdata-impl] created a ThreadLocal with key of type [com.weibo.api.motan.rpc.RpcContext$1] (value [com.weibo.api.motan.rpc.RpcContext$1@1458685b]) and a value of type [com.weibo.api.motan.rpc.RpcContext] (value [com.weibo.api.motan.rpc.RpcContext@735f15a6]) 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.
13-Jul-2017 11:25:01.341 严重 [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [uml-web-api-bigdata-impl] created a ThreadLocal with key of type [com.weibo.api.motan.cluster.ha.FailoverHaStrategy$1] (value [com.weibo.api.motan.cluster.ha.FailoverHaStrategy$1@23a56183]) and a value of type [java.util.ArrayList] (value [[com.weibo.api.motan.protocol.rpc.DefaultRpcProtocol$DefaultRpcReferer@36e8d839]]) 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.
13-Jul-2017 11:25:01.341 严重 [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [uml-web-api-bigdata-impl] created a ThreadLocal with key of type [com.weibo.api.motan.rpc.RpcContext$1] (value [com.weibo.api.motan.rpc.RpcContext$1@1458685b]) and a value of type [com.weibo.api.motan.rpc.RpcContext] (value [com.weibo.api.motan.rpc.RpcContext@5cea56ee]) 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.
13-Jul-2017 11:25:01.342 严重 [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [uml-web-api-bigdata-impl] created a ThreadLocal with key of type [com.weibo.api.motan.cluster.ha.FailoverHaStrategy$1] (value [com.weibo.api.motan.cluster.ha.FailoverHaStrategy$1@23a56183]) and a value of type [java.util.ArrayList] (value [[com.weibo.api.motan.protocol.rpc.DefaultRpcProtocol$DefaultRpcReferer@36e8d839]]) 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.
13-Jul-2017 11:25:01.342 严重 [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [uml-web-api-bigdata-impl] created a ThreadLocal with key of type [com.weibo.api.motan.rpc.RpcContext$1] (value [com.weibo.api.motan.rpc.RpcContext$1@1458685b]) and a value of type [com.weibo.api.motan.rpc.RpcContext] (value [com.weibo.api.motan.rpc.RpcContext@57139af0]) 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.
13-Jul-2017 11:25:01.342 严重 [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [uml-web-api-bigdata-impl] created a ThreadLocal with key of type [com.weibo.api.motan.cluster.ha.FailoverHaStrategy$1] (value [com.weibo.api.motan.cluster.ha.FailoverHaStrategy$1@23a56183]) and a value of type [java.util.ArrayList] (value [[com.weibo.api.motan.protocol.rpc.DefaultRpcProtocol$DefaultRpcReferer@36e8d839]]) 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.
13-Jul-2017 11:25:01.343 严重 [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [uml-web-api-bigdata-impl] created a ThreadLocal with key of type [com.weibo.api.motan.rpc.RpcContext$1] (value [com.weibo.api.motan.rpc.RpcContext$1@1458685b]) and a value of type [com.weibo.api.motan.rpc.RpcContext] (value [com.weibo.api.motan.rpc.RpcContext@5a394446]) 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启动就没有成功吧,查一查tomcat启动失败的具体原因
启动是成功的,并且页面还可以通过RPC查询出结果。
可以确认一下info日志中是否有如下关键字Start to close global resource due to priority
如果没有表示ShutDownHookListener并没有执行
可以参考这部分代码的日志,看看静态资源回收的情况
private synchronized void closeAll() {
Collections.sort(resourceList);
LoggerUtil.info("Start to close global resource due to priority");
for (closableObject resource : resourceList) {
try {
resource.closable.close();
} catch (Exception e) {
LoggerUtil.error("Failed to close " + resource.closable.getClass(), e);
}
LoggerUtil.info("Success to close " + resource.closable.getClass());
}
LoggerUtil.info("Success to close all the resource!");
resourceList.clear();
}
嗯,确实没有这句话。 但是
<listener>
<listener-class>com.weibo.api.motan.closable.ShutDownHookListener</listener-class>
</listener>
已经添加了,还有别的配置么?
不需要别的什么配置,ShutDownHookListener实现了javax.servlet.ServletContextListener,只要能够正确加载就应该可以