deadlock in NIO component (known bug: Oracle 6429204)

Jing LV lvjing at linux.vnet.ibm.com
Mon Mar 7 03:41:05 PST 2011


? 2011-3-1 18:42, Alan Bateman ??:
> Jing LV wrote:
>> Hello,
>>
>>     I've found a bug, and find it already reported (see Oracle Bug 
>> 6429204 Concurrent Selector.register and SelectionKey.interestOps can 
>> ignore interestOps).
>>     However I see there is no work is going on currectly. So does 
>> someone already has a fix? If no,I suppse I may provide a patch, will 
>> someone help me on that?
>> -- 
>> Best Regards,
>> Jimmy, Jing LV
> It would be great if you can provide a test case that demonstrates the 
> issue, and say which platforms you've observed it on (just to make 
> sure that we're talking about the same issue in that bug).
>
> -Alan

Hi Alan,

      Sorry for late replay. Here is the testcase I got. I see deadlock 
running the testcase:

public class Deadlock {
     public static void main(String[] args) throws Exception {
         final Selector selector = Selector.open();

         Thread thread = new Thread(new Runnable() {
             public void run() {
                 while (true) {
                     try {
                         System.out.println("select");
                         selector.select(100);
                     }

                     catch (Exception e) {
                     }
                 }
             }
         });
         thread.start();

         while (true) {
             SocketChannel channel = SocketChannel.open();
             channel.configureBlocking(false);
             channel.register(selector, 0, null);
             System.out.println("close");
             channel.close();
         }

     }
}

       The solution may be add a new lock for cancel().

-- 
Best Regards,
Jimmy, Jing LV

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20110307/d0c59f2c/attachment.html 


More information about the nio-dev mailing list