0

在生产环境中,我经常收到线程挂起的错误消息。

日志如下。

            [12/16/15 16:47:30:095 PHT] 00000030 ThreadMonitor W   WSVR0605W: Thread "WebContainer : 11" (000005bb) has been active for 743576 milliseconds and may be hung.  There is/are 5 thread(s) in total in the server that may be hung. 
                    at java.util.HashMap.getEntry(HashMap.java:479) 
                    at java.util.HashMap.get(HashMap.java:429) 
                    at com.c2lbiz.symbiosys.insurance.product.business.ProductBO.getElementKeyString(ProductBO.java:222) 
                    at com.c2lbiz.symbiosys.insurance.product.business.ProductBO.evaluateField(ProductBO.java:2156) 
                    at com.c2lbiz.symbiosys.insurance.product.business.ProductBO.calculateFundFacets(ProductBO.java:2594) 
                    at com.c2lbiz.symbiosys.insurance.product.business.ProductBO.calculateIllustration(ProductBO.java:1113) 
                    at com.c2lbiz.symbiosys.insurance.quotation.util.QuotationUtil.generateIllustrationOutput(QuotationUtil.java:486) 
                    at com.c2lbiz.symbiosys.insurance.quotation.business.QuoteIllustration.execute(QuoteIllustration.java:49) 
                    at com.c2lbiz.symbiosys.insurance.controller.quotation.QuoteCaptureController.generateIllustrationPDF(QuoteCaptureController.java:176) 
                    at com.c2lbiz.symbiosys.insurance.controller.quotation.GetOutputPreferencesController.process(GetOutputPreferencesController.java:66) 
                    at com.c2lbiz.symbiosys.insurance.controller.quotation.QuoteCaptureController.process(QuoteCaptureController.java:1) 
                    at com.c2lbiz.symbiosys.systemcommon.controller.BaseController.handleRequestInternal(BaseController.java:106) 
                    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) 
                    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) 
                    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900) 
                    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827) 
                    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:874) 
                    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:790) 
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595) 
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) 
                    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230) 
                    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779) 
                    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478) 
                    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) 
                    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136) 
                    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97) 
                    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359) 
                    at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) 
                    at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) 
                    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
                    at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101) 
                    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
                    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
                    at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:271) 
                    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
                    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
                    at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89) 
                    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
                    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
                    at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89) 
                    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
                    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
                    at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235) 
                    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
                    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
                    at org.springframework.security.concurrent.ConcurrentSessionFilter.doFilterHttp(ConcurrentSessionFilter.java:99) 
                    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
                    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371) 
                    at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174) 
                    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) 
                    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) 
                    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195) 
                    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) 
                    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967) 
                    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107) 
                    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87) 
                    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:919) 
                    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662) 
                    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200) 
                    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463) 
                    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530) 
                    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316) 
                    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88) 
                    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) 
                    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) 
                    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) 
                    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) 
                    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) 
                    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) 
                    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) 
                    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881) 

它从挂线程 1 开始意味着

            There is/are 1 thread(s) in total in the server that may be hung. 
            There is/are 2 thread(s) in total in the server that may be hung. 
            There is/are 3 thread(s) in total in the server that may be hung. 
            There is/are 4 thread(s) in total in the server that may be hung. 
            There is/are 5 thread(s) in total in the server that may be hung. 
            There is/are 6 thread(s) in total in the server that may be hung. 
            There is/are 7 thread(s) in total in the server that may be hung. 
            There is/are 8 thread(s) in total in the server that may be hung. 
            There is/are 9 thread(s) in total in the server that may be hung. 
            There is/are 10 thread(s) in total in the server that may be hung. 
            ...............
            ...............
            There is/are 77 thread(s) in total in the server that may be hung. 

之后 PDF 生成停止工作,批处理也停止运行。批处理作业生成 pdf 并发送到提供的电子邮件 ID。此错误的根本原因是什么?相同的代码在 UAT 和 SIT 环境中运行良好。

4

1 回答 1

2

在某些情况下,来自未同步的 HashMap 的 get() 可能会导致无限循环。如果并发 put() 导致 Map 重新散列,则可能发生这种情况。就我而言:我正在使用不同步的哈希图和并发线程调用该哈希图上的 get 和 put 方法。它导致 get 方法的无限循环并且线程被挂起。这是我的观察。

于 2015-12-22T17:16:39.370 回答