Issue Details (XML | Word | Printable)

Key: DIRMINA-200
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Trustin Lee
Reporter: Simon Temple
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
MINA

IBM iSeries throws unexpected SocketException

Created: 04/Apr/06 10:33 PM   Updated: 26/May/09 12:50 AM
Return to search
Component/s: None
Affects Version/s: 0.9.3, 0.9.4
Fix Version/s: 0.9.5

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works mina-ex.patch 2006-04-04 10:35 PM Simon Temple 2 kB
Environment: mina-0.9.3 JDK 1.4.2 IBM iSeries OS/400 V5R2

Resolution Date: 09/Aug/06 07:33 AM


 Description  « Hide
Proposal of a change to nio SocketSessionImpl.

I'd like the calls to:

getTrafficClass
setTrafficClass
setSendBufferSize
setReceiveBufferSize

to not throw RuntimeIOException when a SocketException is caught.

My reasoning is based on the Socket class javadoc:

E.g. setTrafficClass

"As the underlying network implementation may ignore this value applications should consider it a hint."

and

"Setting bits in the precedence field may result in a SocketException indicating that the operation is not permitted."


The other getter/setter method javadoc also refer to 'hints' and a 'if there is an error obtaining' condition.

Some operating systems (OS/400 in my case ;-) ), do not allow the trafficClass value to be read or written. I think this may also be the case as reported here on Linux:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4709474

By ignoring the SocketException thrown by these methods (perhaps issuing a log4j WARN instead? Or hooking up with an appropriate monitor?), socket sessions can be established without error on an IBM iSeries.

Example stack trace:

2006-04-03 17:26:26,343 WARN [org.apache.mina.common.support.DefaultExceptionMonitor](SocketAcceptor-0) Unexpected exception.
org.apache.mina.common.RuntimeIOException: java.net.SocketException
at java.lang.Throwable.<init>(Throwable.java:240)
at java.lang.Exception.<init>(Exception.java:77)
at java.lang.RuntimeException.<init>(RuntimeException.java:77)
at org.apache.mina.common.RuntimeIOException.<init>(RuntimeIOException.java:48)
at org.apache.mina.transport.socket.nio.support.SocketSessionImpl$SocketSessionConfigImpl.setTrafficClass(SocketSessionImpl.java:342)
at org.apache.mina.transport.socket.nio.support.SocketSessionImpl.<init>(SocketSessionImpl.java:71)
at org.apache.mina.transport.socket.nio.support.SocketAcceptorDelegate$Worker.processSessions(SocketAcceptorDelegate.java:379)
at org.apache.mina.transport.socket.nio.support.SocketAcceptorDelegate$Worker.run(SocketAcceptorDelegate.java:326)
Caused by: java.net.SocketException
at java.lang.Throwable.<init>(Throwable.java:180)
at java.lang.Exception.<init>(Exception.java:29)
at java.io.IOException.<init>(IOException.java:28)
at java.net.SocketException.<init>(SocketException.java:35)
at sun.nio.ch.Net.setIntOption(Net.java:156)
at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:398)
at sun.nio.ch.SocketOptsImpl.setInt(SocketOptsImpl.java:46)
at sun.nio.ch.SocketOptsImpl$IP.typeOfService(SocketOptsImpl.java:249)
at sun.nio.ch.OptionAdaptor.setTrafficClass(OptionAdaptor.java:158)
at sun.nio.ch.SocketAdaptor.setTrafficClass(SocketAdaptor.java:320)
... 4 more

I have attached a proposed patch and welcome any comments.

SimonT


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #394852 Tue Apr 18 06:00:01 UTC 2006 trustin Fixed issue: DIRMINA-200 (IBM iSeries throws unexpected SocketException)
* Socket/DatagramSessionConfigImpl now pre-calculates default values and availability of socket options
Files Changed
MODIFY /directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionConfigImpl.java
MODIFY /directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
MODIFY /directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
MODIFY /directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionConfigImpl.java

Repository Revision Date User Message
ASF #415870 Wed Jun 21 01:52:54 UTC 2006 trustin Possible fix for DIRMINA-200: IBM iSeries throws unexpected SocketException
* added special handling code for getTrafficClass
Files Changed
MODIFY /directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionImpl.java