directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wes McKean <wmck...@logictrends.com>
Subject Re: Serverside NIO: Not ready for Prime Time
Date Tue, 25 Nov 2003 16:13:00 GMT
If you want to look at my code, check out the nio sub project under sandbox0 
on the sf.net site.  To recap at a high level here, I am:

1.  Creating a non blocking server socket which waits for connect events.  
Once a connect event occurs, the resulting SocketChannel is accepted and 
passed off to the input manager.

2.  The InputManager makes the SocketChannel non-blocking, then registers it 
for READ events with its Selector.  This occurs in two different threads 
( the registration and the selecting ).

3.  When a read event occurs, I do the usual.  I get the selected keys, get an 
iterator, process them one at a time, removing them as I do, then loop back 
around to select again.

I am getting two errors, a NullPointerException, and a CancelledKeyException.  

The CancelledKeyException seems to be happing because I am removing the 
SelectionKey from the iterator.  The other error seems to occur when I have 
multiple reads and writes going on with different SocketChannels.  Here is 
the exception:

java.lang.NullPointerException
        at sun.nio.ch.WindowsSelectorImpl
$SubSelector.processFDSet(WindowsSelect
orImpl.java:309)
        at sun.nio.ch.WindowsSelectorImpl
$SubSelector.processSelectedKeys(Window
sSelectorImpl.java:284)
        at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$2600
(WindowsSelecto
rImpl.java:245)
        at 
sun.nio.ch.WindowsSelectorImpl.updateSelectedKeys(WindowsSelectorImpl
.java:427)
        at 
sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:142)

        at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:59)
        at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:70)
        at ldapd.server.input.InputModule.run(InputModule.java:131)
        at java.lang.Thread.run(Thread.java:534)

Wes

On Tuesday 25 November 2003 08:38 am, Peter Donald wrote:
> On Tue, 25 Nov 2003 11:56 pm, Wes McKean wrote:
> > I was running ldapd on a Windows XP box with  the new server side NIO
> > stuff included, and I was getting all kinds of weird messages inside the
> > sun implementation classes.  The same exact code works fine under Linux. 
> > It is my professional opinion that there are some issues with the Windows
> > XP implementation of non-blocking sockets, and we couldn't put this stuff
> > into the server until these issues are addressed.
>
> There are a large number of platform specific issues - but that is no
> different from differences between pre-nio sockets on linux and windows. I
> have been building a NIO based network layer recently so if you describe
> some of the exact issues then I may be able to show how to avoid or give
> code to do just that.


Mime
View raw message