Java RMI timeout in callback

We are using Java RMI for communication. An RMI client passes a processing request and an object with a callback method to an RMI server. The server invokes the callback when it is done with processing. The setup is similar to the one described in RMI Callbacks.

Occasionally we are getting a "read time out" exception in the server upon invoking the callback method. The callback thread stalls for about a minute before the exception is raised.

java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: Read timed out
    at sun.rmi.transport.tcp.TCPChannel.createConnection(
    at sun.rmi.transport.tcp.TCPChannel.newConnection(
    at sun.rmi.server.UnicastRef.invoke(
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(
    at $Proxy2.finished(Unknown Source)
    at com.unrisk.db.grid.GridTask.invokeCallback(com.unrisk.db.grid.GridTask:1292)
    at com.unrisk.db.grid.GridTask.invokeCallbacks(com.unrisk.db.grid.GridTask:1304)
    at com.unrisk.db.service.tasks.EquityMDTask.afterRun(com.unrisk.db.service.tasks.EquityMDTask:276)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
    at java.util.concurrent.ThreadPoolExecutor$
Caused by: Read timed out
    at Method)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(
    ... 12 more

We are using Sun Java JDK 1.6.0_18 under Windows Server 2003 32-bit.

Is it possible to work around the connection problems by tuning RMI related system properties?


A lot of the timeouts are described in this bookmark-worthy post:

In my (limited) experience with JRMP, I found I had to use JVM-global properties to tweak the read timeouts...

digression: My team now uses Jeri (Java extensible remote invocation) exclusively, which is part of the Apache River (formerly: Sun Jini) project. Jeri is a lot more configurable than JRMP, allowing you to define your own underlying protocols.

Need Your Help

How to output in the the log window in perforce client p4v using custom tools

python logging perforce customtool

We're developing perforce custom tools in python and we're outputting messages during the script execution. It shows up in p4win but we're mainly using p4v and the output doesn't show up in the log

Testing Routes in MVC unit-testing routes url-routing

I'm using some code from Steve Sandersons MVC Framework book (2nd Ed.). I've got a class called Category that builds a RouteValueDictionary using it's other properties which I then use in the menu....