The
- My Java application is a WAR deployed to JBoss (4.0.4GA)
- Publishes and subscribes to an ActiveMQ instance (5.6.0)
- Java application uses Apache Camel (2.10.3) for all integration (creation and consumption) using ActiveMQ
- JBoss and ActiveMQ themselves (CentOS 5.6 Final) are quad-core virtual servers, each virtual is on a different physical
I have a thread hang problem and I see the following in a thread dump:
java.net.SocketInputStream.socketRead0(Native Method) java.net.SocketInputStream.read(SocketInputStream.java:129) java.io.BufferedInputStream.fill(BufferedInputStream.java:218) java.io.BufferedInputStream.read1(BufferedInputStream.java:258) java.io.BufferedInputStream.read(BufferedInputStream.java:317) sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687) sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632) sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195) java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379) org.springframework.remoting.httpinvoker.SimpleHttpInvokerRequestExecutor.validateResponse(SimpleHttpInvokerRequestExecutor.java:146) org.springframework.remoting.httpinvoker.SimpleHttpInvokerRequestExecutor.doExecuteRequest(SimpleHttpInvokerRequestExecutor.java:66) org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.executeRequest(AbstractHttpInvokerRequestExecutor.java:136) org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:192) org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:174) org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:142) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) $Proxy117.SigmaCruxer(Unknown Source) com.tms.SigmaClient.SigmaClient.processMessage(SigmaClient.java:46) com.tms.SigmaClient.SigmaServiceEndpoint.doSigma(SigmaServiceEndpoint.java:29) com.tms.SigmaClient.SigmaServiceEndpoint.mark(SigmaServiceEndpoint.java:43) sun.reflect.GeneratedMethodAccessor193.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:329) org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:231) org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:169) org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:104) org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74) org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:102) org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:72) org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50) org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:114) org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:284) org.apache.camel.processor.SendProcessor.process(SendProcessor.java:109) org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98) org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89) org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69) org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98) org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89) org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99) org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318) org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209) org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:305) org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102) org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98) org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89) org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69) org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:104) org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85) org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:91) org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560) org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498) org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467) org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325) org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263) org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058) org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050) org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947) java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) java.lang.Thread.run(Thread.java:662)
In accordance with these two skills: ( here and here ), my JBoss application has an I / O lock on Socket.read() , awaiting completion of the response from the service provider located below (in my case, ActiveMQ). Again, according to these articles, the culprit is one of the following 3 points:
- ActiveMQ is in an unhealthy / unstable state and reacts too slowly, as a result of which the listen / wait / lock threads hang; or
- The ActiveMQ instance itself works fine, but it handles an operation (writing to KahaDB, etc.) that ends too long, again causing my threads to hang; or
- There are network issues between my JBoss application (WAR) and my ActiveMQ instance.
I am trying to figure out which of the three takes place. Is there anything in this thread dump to indicate which one it is? My understanding (after reading these articles) is that the real hang is that the client-side socket (blocking) has just not received all the bytes it needs to consider completing the response; that is, he did not receive any response from ActiveMQ or simply did not receive a full response.
Therefore, I ask:
- Is there a clear idea of ​​which of the three scenarios takes place? If so, what / why? If not, what should be my next step (I am also the “administrator” who configured ActiveMQ so that I have full access to it, as well as JBoss and WAR deployed on it).
- Can a JBoss update upgrade to this? Perhaps 4.0.4GA uses the "old" (blocking) Java I / O, whereas newer versions can use NIO? Probably a long shot, but he still cannot discredit him.
- Both articles emphasize that the correct socket-timeout configuration should be implemented, which can greatly mitigate all this (although it does not address the problems associated with abandoning ActiveMQ and / or networks):
- Is this a timeout that I would write in my Java code? If so, how and with which API? Jms Some banners on the client side ActiveMQ?
- Is this a timeout that I am implementing at the OS level? If so, I'm not sure how to proceed ...
- Is this a timeout that I implement on the server side (ActiveMQ)? If so, how?
I think I'm closing the solution here, but it seems to be stuck and hard to see the forest through the trees. Thanks in advance!
java multithreading sockets jboss activemq
IAmYourFaja
source share