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

JDK 1.1.6, 1.2/Windows NT: Interrupting a thread blocked does not unblock IO

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.1.3, 1.1.4, 1.1.5, 1.1.6
    • core-libs
    • None
    • generic, x86
    • generic, windows_95, windows_nt

      With JDK 1.1.6, on Solaris, if you interrupt a thread which is blocked
      on network IO (specifically, read), the read gets terminated with
      InterruptedIOException. On Windows NT, no such exception is thrown
      and the thread is left blocked in the read call.

      Attached is a test program to demo the bug. On Solaris, the output is:
      pause...
      Waiting to accept connections: ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=1234]
      awake...
      Creating connection to server
      Created connection: Socket[addr=localhost/127.0.0.1,port=1234,localport=37294]
      pause...
      Got connection: Socket[addr=localhost/127.0.0.1,port=37294,localport=1234]
      Blocking on read
      awake...
      Interrupting other thread which should be stopped in read
      Interrupt called
      exiting
      PASS: Interrupted as expected
      java.io.InterruptedIOException: operation interrupted
               at java.net.SocketInputStream.read(SocketInputStream.java:92)
               at java.net.SocketInputStream.read(SocketInputStream.java:108)
               at test$1.run(test.java:19)
      gzilla%


      On Windows, the PASS line does not get generated:
      pause...
      Waiting to accept connections: ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=1234]
      awake...
      Creating connection to server
      Created connection: Socket[addr=localhost/127.0.0.1,port=1234,localport=1043]
      pause...
      Got connection: Socket[addr=localhost/127.0.0.1,port=1043,localport=1234]
      Blocking on read
      awake...
      Interrupting other thread which should be stopped in read
      Interrupt called
      exiting

      The source of this program is attached.

            alanb Alan Bateman
            jjg Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: