In message <[email protected]>, Charles Lee writes: > > Hi Niklas, > Thanks for your testing code. I have run it on the linux and reproduced the > error. After some investigation, I find something really confused me: when > poll in the NetworkInterfaceLinux.c line 300, we encounter a system > interrupt call. This is where the socket exception from. > > Anybody has encountered this? or is there somewhere some code will interrupt > the thread? > > By the way, I have read some code in the file: NioSocketAcceptor, > AbstractPollingIoAcceptor to see what is acctually doing when bind an > address, only to find that MINA first select the Selector then register the > Selector. That seems strange for me.
I can see a number of issues with the native code too. The windows implementation of selectImpl returns an error code from a portlib function (hysock_select). This makes sense because it allows the Java code to correctly test to see if the result is ERRORCODE_SOCKET_TIMEOUT. However, the unix implementation returns the result of a native poll call which is not then mapped to the platform independent portlib error code so will always return -1. This must be wrong. The unix implementation should be fixed to return the correct platform independent error codes. Then the implementation can be fixed to return (HYPORT_)ERROR_SOCKET_INTERRUPTED which the Java code can check for and avoid throwing the exception. I'll take a look at fixing the native code. -Mark. The Java code could then be modified to make being > On Tue, Feb 24, 2009 at 4:21 AM, Niklas Gustavsson <[email protected]>wrot > e: > > > On Mon, Feb 23, 2009 at 9:57 AM, Niklas Gustavsson <[email protected]> > > wrote: > > > Does running the MINA or FtpServer unit tests count as a simple > > > testcase? :-) If not, I'll attempt to see if I can trim it down to a > > > simple JUnit test case. > > > > Using the following code, this exception will be thrown every 10 run or so: > > IoAcceptor acceptor = new NioSocketAcceptor(); > > acceptor.setHandler(new IoHandlerAdapter()); > > acceptor.bind(); > > acceptor.unbind(); > > acceptor.dispose(); > > > > This requires MINA and SLF4J on the classpath. > > > > Let me know if I can be of any further help! > > > > /niklas > > > > > > -- > Yours sincerely, > Charles Lee > > --00163646c6f0ca5ca40463a4ede0-- >
