A race problem about select in a small time window

Alan Bateman Alan.Bateman at oracle.com
Sun Mar 10 14:16:18 PDT 2013


On 07/03/2013 17:40, Alan Bateman wrote:
>
> Sean - just a brief mail to say that I agree that there is an issue 
> here (your changes to the impl. to reliably duplicate it are very 
> useful). I need to study it a bit more before commenting on the 
> proposed fix because it's a complicated scenario and also isOpen can 
> return true at any time (due to async close). I will get back to you 
> soon on this.
>
> -Alan
I've created 8009751 to track this issue and I've put a preliminary fix 
here:

http://cr.openjdk.java.net/~alanb/8009751/webrev/

The changes essentially mean that the Selector will now maintain an 
accurate view of the registrations so that the bulk update (at select 
time) does not need to be concerned with the channel state. For 
interestOps then it keeps it very simple as it just "queues" the update. 
The release is also simple as it do longer need to iterate over the 
pending updates.

So far I've only done limited testing but all tests that I've tried so 
far pass. I don't know the background to your test case/patch but it 
would be great if you could test the patch with the application or test 
that you originally ran into this issue with.

I think for now we can use 8009751 for this issue. As part this patch 
I've also changed a lot of other code (impact the other Selectors) but 
I'll this back for now so as now (the clean-up can be done in a later bug).

-Alan.


More information about the nio-dev mailing list