0 Replies Latest reply on Aug 2, 2011 4:43 PM by 811912

    Connection reset exception from SocketInputStream.read during a RMI call

      Issue is on a Client/Server application using Swing and RMI


      Windows Client JRE: Java Web Start 1.6.0_24

      Solaris 10

      We are seeing an issue which is happening once in a day.

      Here is the Issue.

      ~ Java Swing Client is making a simple RMI call to Server to invoke a method.
      ~ This call was never finished and it finally fails with connect reset error at client side.
      ~ Server is up and running. From our initial analysis Network Connectivity seems to be ok. But we are still working to use wireshark kind of tool to trace down any packet loss.
      ~ Here is the exception

      ava.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
           java.net.SocketException: Connection reset
           at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
           at sun.rmi.server.UnicastRef.invoke(Unknown Source)
           at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source)
           at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source)
           at $Proxy1.getNextTask(Unknown Source)
           at com.trueposition.scout.common.util.ClientTaskRunner$ServerThread.run(ClientTaskRunner.java:121)
      Caused by: java.net.SocketException: Connection reset
           at java.net.SocketInputStream.read(Unknown Source)
           at java.io.BufferedInputStream.fill(Unknown Source)
           at java.io.BufferedInputStream.read(Unknown Source)
           at java.io.DataInputStream.readByte(Unknown Source)
           ... 6 more

      ~ So after tracking from JDK source Connection reset exception is coming from SocketInputStream.read() . In this method there are two places we are throwing Connect Reset exception

      // connection reset
           if (impl.isConnectionReset()) {
           throw new SocketException("Connection reset");

      ~ Impl seems to be PlainSocketImpl and we have set method in that

      public void setConnectionReset() {
           synchronized (resetLock) {
      resetState = CONNECTION_RESET;

      ~ Not sure who is the calling this setConnectionReset . Does native code call this?
      ~ Can some one explain what is the scenario we will get Connect Reset Exception from Socket inputstream. We are still suspecting network. But no evidence as of now.
      ~ Any thoughts on this will be helpful