Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8076158

unstable SocketInputStream.read() behavior after the connection is reset

XMLWordPrintable

      In the following case on Windows, the result of SocketInputStream.read()
      becomes unstable depending on how to send the data .

      (example scenario)
      1) The server sends 22KB data to the client.
      2) The client sleeps for a while after reading 16KB.
      3) After 2 mins, Windows resets the connection because it is half-closed.
      4) The client tries to read the rest data(6KB).


      (case A)
      The server sends 22KB data at once at 1.
      -> The client can read the rest data at 4.

      (case B)
      The server sends 22KB data little by little at 1.
      -> The client face java.net.SocketException at 4.

      ------------------
      java.net.SocketException: Connection reset
              at java.net.SocketInputStream.read(Unknown Source)
              at java.net.SocketInputStream.read(Unknown Source)
              at java.io.BufferedInputStream.read1(Unknown Source)
              at java.io.BufferedInputStream.read(Unknown Source)
              at java.io.FilterInputStream.read(Unknown Source)
      ------------------

            coffeys Sean Coffey
            shadowbug Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: