Review request for 6693490

Alan Bateman Alan.Bateman at Sun.COM
Mon Mar 23 16:38:13 UTC 2009

6693490: (se) select throws "File exists" IOException under load (lnx)

Sherman, we've chatted about this issue so you will probably want to 
review. It's a race between registration (or re-registration) and close. 
Registrations are queued so that they come into effect at the next 
select (as required by the spec) but if the channel is pre-closed just 
before it is added to epoll then it possible that the socketpair, used 
in the closing mechanism, gets registered with epoll.  Once that happens 
it creates the conditions to cause a Selector spin, and where the file 
descriptor is recycled for a new SelectableChannel, then registration 
will fail with IOException "file exists". The fix is to remove from 
epoll before the channel is killed and to skip pending updates for 
closed channels (as these can result in re-registration). To avoid any 
side effects with cancellation the deregister also purges pending 
updates for the channel. Thanks to Serge Baranov, Robert Larsen, Peter 
van Rensburg, Richard Ridgway, Greg Wilkins and others for testing this 
fix, or preliminary versions of.

The webrev is here:


More information about the core-libs-dev mailing list