I'm working on a Java 6 application with JBoss 5 and I'm trying to solve an issue that has been lasting for weeks. When deploying my application, it tries to do a RMI call to another server, but it won't get any response and the application will remain stuck at the call. The thing is that the connection in the server is quite inconsistent, so the best solution to deal with this was to define a socket timeout.
I tried using every RMI timeout JVM flag here, adding them in the run.conf.bat inside jboss directory and bin folder (and they are being loaded is I can see them in boot.log file): https://docs.oracle.com/javase/7/docs/technotes/guides/rmi/sunrmiproperties.html
I also tried adding the following configurations in ejb3-connectors-jboss-beans.xml:
<parameter>socket://§{jboss.bind.address}:§[port}?timeout=2000</parameter>
and
<parameter>socket://§{jboss.bind.address}:§[port}?socketTimeout=2000</parameter>
But the flags doesn't seems to be respected and the app still get stuck in the RMI call. Do you guys knows any timeout configuration I can do that might work in this case?
Here's the threaddump of the following situation:
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
- locked <0x0000000795becf10> (a java.io.BufferedInputStream)
at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2271)
at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2451)
at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2521)
at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2593)
at java.io.ObjectInputStream.read(ObjectInputStream.java:818)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.readVersion(MicroSocketClientInvoker.java:1263)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:838)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)
at org.jboss.remoting.Client.invoke(Client.java:1724)
at org.jboss.remoting.Client.invoke(Client.java:629)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
at com.sun.proxy.$Proxy901.invoke(Unknown Source)
at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
at com.sun.proxy.$Proxy958.getMessageTypeActivationTreeLocal(Unknown Source)
at sun.reflect.GeneratedMethodAccessor498.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.company.utl.servicelocator.CompanyServiceInvocationHandler.invoke(Unknown Source)
[...] (custom methods and stuff)