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

Not possible to read data from socket after write detects connection reset

XMLWordPrintable

    • b04
    • 11
    • b17
    • Verified

        ADDITIONAL SYSTEM INFORMATION :
        $ uname -a
        Linux ubuntu-dev 4.4.0-124-generic #148-Ubuntu SMP Wed May 2 13:00:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

        $ java -version
        java version "11-ea" 2018-09-25
        Java(TM) SE Runtime Environment 18.9 (build 11-ea+15)
        Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11-ea+15, mixed mode)

        A DESCRIPTION OF THE PROBLEM :
        When a write fails with a connection-reset when using Socket its not possible to read any remaining data from the Socket. This should be possible and was possible in previous java versions.

        More details on the issue can be found here:

        http://mail.openjdk.java.net/pipermail/net-dev/2018-May/011511.html

        REGRESSION : Last worked in version 11 b04 ( prior to JDK-8199329)

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run the netty testsuite, or just this test:

        https://github.com/netty/netty/blob/netty-4.1.25.Final/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketHalfClosedTest.java#L231

        $ cd testsuite
        $ ../mvnw clean test -Dtest=SocketHalfClosedTest#testAutoCloseFalseDoesShutdownOutput

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        It should be possible to read data from a socket if there is remaining data left and write causes a connection reset.
        ACTUAL -
        As soon as a connection reset happened on a write, read also throws a SocketException.

        ---------- BEGIN SOURCE ----------
        https://github.com/netty/netty/blob/netty-4.1.25.Final/testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketHalfClosedTest.java#L231
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        none...

        FREQUENCY : always


              alanb Alan Bateman
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: