-
Bug
-
Resolution: Fixed
-
P3
-
5.0u17
-
b22
-
x86
-
linux_redhat_5.0
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2218590 | 6u32 | Sean Coffey | P3 | Closed | Fixed | b01 |
JDK-2220349 | 6u31-rev | Sean Coffey | P3 | Closed | Fixed | b21 |
JDK-2217577 | 5.0u35 | Sean Coffey | P3 | Closed | Fixed | b01 |
When a customer try to do some operation for closed SocketChannel, the exception message does not seem appropriate.
CONFIGURATION:
JDK5u17/RHEL5
TEST CASE:
-------------------------------------------------------------
import java.nio.channels.*;
public class TestSocket {
public static void main(String[] args) throws Exception {
SocketChannel sc = SocketChannel.open();
sc.configureBlocking(false);
Selector sel = Selector.open();
sc.register(sel, 0);
sel.selectNow();
sc.close();
sc.socket().setTcpNoDelay(false);
}
}
-------------------------------------------------------------
REPRODUCE:
Compile the attached test case and run
The following message will show up.
java.net.SocketException: Operation not supported
at sun.nio.ch.Net.setIntOption0(Native Method)
at sun.nio.ch.Net.setIntOption(Net.java:152)
at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:372)
at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
at com.sun.enterprise.web.connector.grizzly.SelectorThread.setSocketOptions(SelectorThread.java:1956)
at com.sun.enterprise.web.connector.grizzly.SelectorThread.handleAccept(SelectorThread.java:1517)
....
"Operation not Supported" is EOPNOTSUPP.
So, the message,"Socket is closed" seems appropriate in this case
like the following result in jdk7.
----
Exception in thread "main" java.net.SocketException: Socket is closed
at sun.nio.ch.Net.translateToSocketException(Net.java:105)
at sun.nio.ch.SocketAdaptor.setBooleanOption(SocketAdaptor.java:288)
at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:321)
at TestSocket.main(TestSocket.java:11)
Caused by: java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.setOption(SocketChannelImpl.java:170)
at sun.nio.ch.SocketAdaptor.setBooleanOption(SocketAdaptor.java:286)
... 2 more
------
CONFIGURATION:
JDK5u17/RHEL5
TEST CASE:
-------------------------------------------------------------
import java.nio.channels.*;
public class TestSocket {
public static void main(String[] args) throws Exception {
SocketChannel sc = SocketChannel.open();
sc.configureBlocking(false);
Selector sel = Selector.open();
sc.register(sel, 0);
sel.selectNow();
sc.close();
sc.socket().setTcpNoDelay(false);
}
}
-------------------------------------------------------------
REPRODUCE:
Compile the attached test case and run
The following message will show up.
java.net.SocketException: Operation not supported
at sun.nio.ch.Net.setIntOption0(Native Method)
at sun.nio.ch.Net.setIntOption(Net.java:152)
at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:372)
at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
at com.sun.enterprise.web.connector.grizzly.SelectorThread.setSocketOptions(SelectorThread.java:1956)
at com.sun.enterprise.web.connector.grizzly.SelectorThread.handleAccept(SelectorThread.java:1517)
....
"Operation not Supported" is EOPNOTSUPP.
So, the message,"Socket is closed" seems appropriate in this case
like the following result in jdk7.
----
Exception in thread "main" java.net.SocketException: Socket is closed
at sun.nio.ch.Net.translateToSocketException(Net.java:105)
at sun.nio.ch.SocketAdaptor.setBooleanOption(SocketAdaptor.java:288)
at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:321)
at TestSocket.main(TestSocket.java:11)
Caused by: java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.setOption(SocketChannelImpl.java:170)
at sun.nio.ch.SocketAdaptor.setBooleanOption(SocketAdaptor.java:286)
... 2 more
------
- backported by
-
JDK-2217577 (so) Socket adpator is not synchronized on channel state
- Closed
-
JDK-2218590 (so) Socket adpator is not synchronized on channel state
- Closed
-
JDK-2220349 (so) Socket adpator is not synchronized on channel state
- Closed