萝卜白菜。
2021-06-29 09:15
采纳率: 100%
浏览 159
已结题

TongWeb高并发下阻塞ClassLoader.getResource下

TongWeb高并发下打jstack,发现线程大部分如下,请问什么原因?

"http-nio2-0.0.0.0-8088-exec-188" #9227 daemon prio=5 os_prio=0 tid=0x0000fffeb8364000 nid=0x18724 waiting for monitor entry [0x0000fffe7ca6c000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at sun.misc.URLClassPath.getNextLoader(URLClassPath.java:479)
    - waiting to lock <0x000000008060ef00> (a sun.misc.URLClassPath)
    at sun.misc.URLClassPath.findResource(URLClassPath.java:224)
    at java.net.URLClassLoader$2.run(URLClassLoader.java:572)
    at java.net.URLClassLoader$2.run(URLClassLoader.java:570)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findResource(URLClassLoader.java:569)
    at java.lang.ClassLoader.getResource(ClassLoader.java:1090)
    at java.lang.ClassLoader.getResource(ClassLoader.java:1085)
    at java.lang.ClassLoader.getResource(ClassLoader.java:1085)
    at com.tongweb.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1023)
    at com.tongweb.tomee.catalina.ThanosTomEEWebappClassLoader.getResource(ThanosTomEEWebappClassLoader.java:190)
    at java.lang.Class.getResource(Class.java:2267)
    at org.samples.TestFilter.doFilterInternal(TestFilter.java:17)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:126)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:64)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:101)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:119)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at com.tongweb.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at com.tongweb.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
    at com.tongweb.catalina.core.ThanosStandardContextValve.invoke(ThanosStandardContextValve.java:107)
    at com.tongweb.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
    at com.tongweb.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:452)
    at com.tongweb.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at com.tongweb.tomee.catalina.OpenEJBSecurityListener$RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
    at com.tongweb.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
    at com.tongweb.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at com.tongweb.catalina.core.ThanosStandardEngineValve.invoke(ThanosStandardEngineValve.java:43)
    at com.tongweb.catalina.realm.RealmValve.invoke(RealmValve.java:21)
    at com.tongweb.catalina.connector.ThanosCoyoteAdaptor.service(ThanosCoyoteAdaptor.java:460)
    at com.tongweb.coyote.http11.Http11Processor.service(Http11Processor.java:780)
    at com.tongweb.coyote.http11.ThanosHttp11Processor.service(ThanosHttp11Processor.java:19)
    at com.tongweb.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at com.tongweb.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:913)
    at com.tongweb.web.util.net.Nio2Endpoint$SocketProcessor.doRun(Nio2Endpoint.java:1610)
    at com.tongweb.web.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    - locked <0x00000000fea16e70> (a com.tongweb.web.util.net.Nio2Endpoint$Nio2SocketWrapper)
    at com.tongweb.web.util.net.AbstractEndpoint.processSocket(AbstractEndpoint.java:853)
    at com.tongweb.web.util.net.Nio2Endpoint$Nio2SocketWrapper$4.completed(Nio2Endpoint.java:640)
    at com.tongweb.web.util.net.Nio2Endpoint$Nio2SocketWrapper$4.completed(Nio2Endpoint.java:618)
    at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
    at sun.nio.ch.Invoker$2.run(Invoker.java:218)
    at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
    at com.tongweb.web.util.threads.TWThreadPoolExecutor.runWorker(TWThreadPoolExecutor.java:1172)
    at com.tongweb.web.util.threads.TWThreadPoolExecutor$Worker.run(TWThreadPoolExecutor.java:628)
    at com.tongweb.web.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)

"http-nio2-0.0.0.0-8088-exec-187" #9226 daemon prio=5 os_prio=0 tid=0x0000fffeb8363000 nid=0x18723 waiting for monitor entry [0x0000fffe7cc6c000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at sun.misc.URLClassPath.getNextLoader(URLClassPath.java:479)
    - waiting to lock <0x000000008060ef00> (a sun.misc.URLClassPath)
    at sun.misc.URLClassPath.findResource(URLClassPath.java:224)
    at java.net.URLClassLoader$2.run(URLClassLoader.java:572)
    at java.net.URLClassLoader$2.run(URLClassLoader.java:570)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findResource(URLClassLoader.java:569)
    at java.lang.ClassLoader.getResource(ClassLoader.java:1090)
    at java.lang.ClassLoader.getResource(ClassLoader.java:1085)
    at java.lang.ClassLoader.getResource(ClassLoader.java:1085)
    at com.tongweb.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1023)
    at com.tongweb.tomee.catalina.ThanosTomEEWebappClassLoader.getResource(ThanosTomEEWebappClassLoader.java:190)
    at java.lang.Class.getResource(Class.java:2267)
    at org.samples.TestFilter.doFilterInternal(TestFilter.java:17)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:126)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:64)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:101)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:119)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at com.tongweb.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at com.tongweb.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
    at com.tongweb.catalina.core.ThanosStandardContextValve.invoke(ThanosStandardContextValve.java:107)
    at com.tongweb.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
    at com.tongweb.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:452)
    at com.tongweb.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at com.tongweb.tomee.catalina.OpenEJBSecurityListener$RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
    at com.tongweb.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
    at com.tongweb.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at com.tongweb.catalina.core.ThanosStandardEngineValve.invoke(ThanosStandardEngineValve.java:43)
    at com.tongweb.catalina.realm.RealmValve.invoke(RealmValve.java:21)
    at com.tongweb.catalina.connector.ThanosCoyoteAdaptor.service(ThanosCoyoteAdaptor.java:460)
    at com.tongweb.coyote.http11.Http11Processor.service(Http11Processor.java:780)
    at com.tongweb.coyote.http11.ThanosHttp11Processor.service(ThanosHttp11Processor.java:19)
    at com.tongweb.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at com.tongweb.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:913)
    at com.tongweb.web.util.net.Nio2Endpoint$SocketProcessor.doRun(Nio2Endpoint.java:1610)
    at com.tongweb.web.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    - locked <0x00000000fe937478> (a com.tongweb.web.util.net.Nio2Endpoint$Nio2SocketWrapper)
    at com.tongweb.web.util.net.AbstractEndpoint.processSocket(AbstractEndpoint.java:853)
    at com.tongweb.web.util.net.Nio2Endpoint$Nio2SocketWrapper$4.completed(Nio2Endpoint.java:640)
    at com.tongweb.web.util.net.Nio2Endpoint$Nio2SocketWrapper$4.completed(Nio2Endpoint.java:618)
    at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
    at sun.nio.ch.Invoker$2.run(Invoker.java:218)
    at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
    at com.tongweb.web.util.threads.TWThreadPoolExecutor.runWorker(TWThreadPoolExecutor.java:1172)
    at com.tongweb.web.util.threads.TWThreadPoolExecutor$Worker.run(TWThreadPoolExecutor.java:628)
    at com.tongweb.web.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
 

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • 萝卜白菜。 2021-06-29 09:32
    最佳回答

    解决方法:

    采用TongWeb7.0.4.4版本,增加参数: -DdisableResourceCache=false  表示打开该功能;  -DcacheFilterSuffix=.class,.jsp 表示禁用缓存的文件后缀,逗号分割可配置多个 。

    说明:作用是缓存 getResource 避免重复的加锁, 若resource会更新可能会出错,再尝试在cacheFilterSuffix中过滤掉。 若还不行关闭该功能。

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题