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

Race condition between shutdownInput() and read(byte[], int, int)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • beta
    • x86
    • windows_2000


      ingrid.yao@Eng 2000-09-12

      J2SE Version:
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0beta-b30)
      Java HotSpot(TM) Client VM (build B22, mixed mode)

      Does this problem occur on J2SE 1.3? Yes

      Operating System Configuration Information:
      Microsoft Windows 2000
      5.00.2195

      Hardware Configuration Information (be specific):
      Dell NOTEBOOK I3800
      x86 Family 6 Model 8 Stepping 3
      AT/AT COMPATIBLE
      130,544 KB RAM

      Assuming that shutdownInput() is supposed to unblock a blocked read()
      a race exists between shutdownInput() and read(byte[], int, int) (and
      also read()) on the InputStream returned by java.net.Socket.getInputStream()
      such that calling shutdownInput() doesn't always cause read() to return -1.
      If the call to read() and shutdownInput() happen at the same time it's
      possible for the read() to stay blocked. (If it is wrong about the desired
      behavior of shutdownInput() vis a vis a pending read(), please treat this
      as an RFE to have that be the desired behavior.)


      Steps to Reproduce:

      Compile and run attached ShutdownInputTest.java. It usually freezes
      pretty quickly. Sometimes, however, it will run for quite some time.
      On Windows merely switching window focus away from the window where
      the program is running is usually enough to force the freeze. But it
      usually freezes without doing anything.

            alanb Alan Bateman
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: