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

Deadlock during interrupting FileChannel

    XMLWordPrintable

Details

    Description

      java/nio/channels/FileChannel/InterruptMapDeadlock.java
      java/nio/channels/FileChannel/InterruptDeadlock.java

      These two tests fail intermittently.

      Example log for java/nio/channels/FileChannel/InterruptMapDeadlock.java:

      ----------System.out:(54/2715)----------
      Iteration: 1
      class java.nio.channels.ClosedByInterruptException (expected)
      class java.nio.channels.AsynchronousCloseException (expected)
      class java.nio.channels.AsynchronousCloseException (expected)
      class java.nio.channels.AsynchronousCloseException (expected)
      Iteration: 2
      class java.nio.channels.AsynchronousCloseException (expected)
      class java.nio.channels.ClosedByInterruptException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      Iteration: 3
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedByInterruptException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      Iteration: 4
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedByInterruptException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      Iteration: 5
      class java.nio.channels.ClosedByInterruptException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      Iteration: 6
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedByInterruptException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      Iteration: 7
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.AsynchronousCloseException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedByInterruptException (expected)
      Iteration: 8
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedByInterruptException (expected)
      class java.nio.channels.AsynchronousCloseException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      Iteration: 9
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.AsynchronousCloseException (expected)
      class java.nio.channels.ClosedByInterruptException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      Iteration: 10
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.ClosedByInterruptException (expected)
      Iteration: 11
      class java.nio.channels.ClosedChannelException (expected)
      class java.nio.channels.AsynchronousCloseException (expected)
      class java.nio.channels.AsynchronousCloseException (expected)
      ----------System.err:(26/1528)----------
      Interruptor thread did not terminate:
      java.lang.Exception: Stack trace
      at java.nio.channels.spi.AbstractInterruptibleChannel$1.interrupt(AbstractInterruptibleChannel.java:160)
      at java.lang.Thread.interrupt(Thread.java:919)
      at InterruptMapDeadlock$Interruptor.run(InterruptMapDeadlock.java:87)
      Mapper thread did not terminate:
      java.lang.Exception: Stack trace
      at java.lang.Thread.interrupt(Thread.java:915)
      at sun.nio.ch.NativeThreadSet.signalAndWait(NativeThreadSet.java:109)
      at sun.nio.ch.FileChannelImpl.implCloseChannel(FileChannelImpl.java:129)
      at java.nio.channels.spi.AbstractInterruptibleChannel$1.interrupt(AbstractInterruptibleChannel.java:165)
      at java.nio.channels.spi.AbstractInterruptibleChannel.begin(AbstractInterruptibleChannel.java:173)
      at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:854)
      at InterruptMapDeadlock$Mapper.run(InterruptMapDeadlock.java:53)
      java.lang.RuntimeException: Test failed - see log for details
      at InterruptMapDeadlock.main(InterruptMapDeadlock.java:150)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:484)
      at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:759)
      at java.lang.Thread.run(Thread.java:745)

      JavaTest Message: Test threw exception: java.lang.RuntimeException
      JavaTest Message: shutting down test

      result: Error. Error while cleaning up threads after test

      Attachments

        1. 8054039.diff
          2 kB
        2. deadlock.diff
          2 kB
        3. deadlock.png
          deadlock.png
          116 kB
        4. fix1.diff
          2 kB
        5. fix2.diff
          2 kB
        6. fix3.diff
          3 kB

        Issue Links

          Activity

            People

              fyuan Frank Yuan (Inactive)
              amlu Amy Lu (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: