Bug in sun.nio.ch.SolarisEventPort#port_dissociate

David M. Lloyd david.lloyd at redhat.com
Wed Jun 14 13:35:21 UTC 2017


There's a bug in sun.nio.ch.SolarisEventPort#port_dissociate which 
manifests as an IOException like this:

Exception in thread "default I/O-30" java.lang.InternalError: 
java.io.IOException: File descriptor in bad state
	at sun.nio.ch.EventPortWrapper.release(EventPortWrapper.java:235)
	at 
sun.nio.ch.EventPortSelectorImpl.implDereg(EventPortSelectorImpl.java:144)
	at sun.nio.ch.SelectorImpl.processDeregisterQueue(SelectorImpl.java:149)
	at sun.nio.ch.EventPortSelectorImpl.doSelect(EventPortSelectorImpl.java:75)
	at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
	at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
	at org.xnio.nio.WorkerThread.run(WorkerThread.java:528)
Caused by: java.io.IOException: File descriptor in bad state
	at sun.nio.ch.SolarisEventPort.port_dissociate(Native Method)
	at sun.nio.ch.EventPortWrapper.release(EventPortWrapper.java:233)
	... 6 more

The problem was observed in:

java version "1.8.0_121"
Solaris versions 10 and 11

But I think it also exists in 9.  The problem appears to be that the 
Java_sun_nio_ch_SolarisEventPort_port_1dissociate function in 
SolarisEventPort.c is checking for ENOENT but not EBADFD.  I'm not sure 
if the ENOENT check is needed (the associate variant does not check for 
it even though it's specified to be a possible return), but empirically 
I conclude that the EBADFD check is.

-- 
- DML


More information about the nio-dev mailing list