Name: nt126004 Date: 11/06/2002
FULL PRODUCT VERSION :
$ java -version
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION : Linux 2.2.14
A DESCRIPTION OF THE PROBLEM :
when doing select() on a descriptor, a
java.lang.Error is thrown when a POLLNVAL
is detected.
This normally is not a fatal condition
and indicates that one or more of file
descriptors registered with the selector
are invalid.
Yet Java reports it not as an Exception
but as a java.lang.Error, normally reserved
for fatal and uncorrectable errors.
In my application, it simply kills a thread
and eventually the whole application.
I am moving to intercept and deal with
this java.lang.Error, yet was wondering
if it should be moved to become Exception
intstead ?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create a selector
2. register a number of SocketChannels
3. eventually, as select() is called,
POLLNVAL might get reported.
EXPECTED VERSUS ACTUAL BEHAVIOR :
POLLNVAL is expected to be a subclass of
Exception, not Error
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.Error: POLLNVAL detected
at sun.nio.ch.SocketChannelImpl.translateAndSetReadyOps (
SocketChannelImpl.java:671)
*****
*****
*****
( the rest of stacktrace skipped)
REPRODUCIBILITY :
This bug can be reproduced occasionally.
---------- BEGIN SOURCE ----------
NEXT_SELECT:
while(true) {
try {
i = writeSelector.select();
} catch (Exception ex) {
ex.printStackTrace();
continue NEXT_SELECT;
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
I will try to catch java.lang.Error in the try() block
and see if I can simply repeat the select() and if it
will cure the problem.
(Review ID: 165640)
======================================================================