[8u60] RFR of 8071599: (so) Socket adapter sendUrgentData throws IllegalBlockingMode when channel configured non-blocking

Brian Burkhalter brian.burkhalter at oracle.com
Mon Feb 23 22:14:44 UTC 2015


On Feb 23, 2015, at 1:54 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:

>> This is exactly the point: this approach gives complete consistency across all platforms but at the expense of a little extra code complexity.
>> 
> You will also get consistent behavior just check for 0 in SocketAdaptor with the advantage that you don't drop the platform specific message (which can be useful when in other locales). However it is corner case so not worth spending time on.
> 
> So if you are changing SocketChannel to use isBlocking then it would be good to put add assert Thread.holdsLock(blockingLock()) in sendOutOfBandData to check that the lock is held. The changes otherwise look okay. In the SendUrgentData.java test then you might want to move up the @test tag to match the other tests.

OK so I will update the JDK 9 patch as follows and re-run JPRT:

diff --git a/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java
--- a/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java
+++ b/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java
@@ -520,6 +520,8 @@
 
     // package-private
     int sendOutOfBandData(byte b) throws IOException {
+        assert Thread.holdsLock(this.blockingLock()) :
+            "Blocking lock not held by SocketChannel";
         synchronized (writeLock) {
             ensureWriteOpen();
             int n = 0;
diff --git a/test/java/nio/channels/SocketChannel/SendUrgentData.java b/test/java/nio/channels/SocketChannel/SendUrgentData.java
--- a/test/java/nio/channels/SocketChannel/SendUrgentData.java
+++ b/test/java/nio/channels/SocketChannel/SendUrgentData.java
@@ -27,8 +27,7 @@
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
 
-/*
- * @test
+/* @test
  * @bug 8071599
  * @run main/othervm SendUrgentData
  * @run main/othervm SendUrgentData -inline

Thanks,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20150223/72c3dbfa/attachment.html>


More information about the nio-dev mailing list