0 Replies Latest reply: Aug 2, 2011 11:43 AM by 811912 RSS

    Connection reset exception from SocketInputStream.read during a RMI call

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

      Environment:

      Client:
      Windows7
      Windows Client JRE: Java Web Start 1.6.0_24

      Server:
      Solaris 10
      JRE 1.6.0.19

      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