[ajug-members] Java going bonkers

Christopher Fowler cfowler at outpostsentinel.com
Wed Apr 27 13:51:18 EDT 2005


_newClientChannel is a NIO object.

I forgot a very important piece of code.
After the writer.writeline(..) there is;

String response = reader.readline()

That is where I'm guessing things go wrong.  there is never a response
from reader.readline() because I'm guessing that NIO does not see a read
of 0 bytes as an indication of EOF.  I've had a few problems with NIO
going crazy after an unclean client termination that I'm almost to the
point of creating this piece of code in C.  Why could java not
simply just have implemented select() without all those threads.


After the 
On Wed, 2005-04-27 at 13:43, Ray Elenteny wrote:
> Hard to say exactly what you have going here given your code snippet,
> but it looks like when you're killing the client, the server side
> socket is closing (which is typical behavior).  Is your loop
> continuing regardless of any exception that may be thrown?  Without
> really knowing how the "_newClientChannel" is being produced, it's a
> bit difficult to diagnose.
> 
> Ray
> 
> On 4/27/05, Christopher Fowler <cfowler at outpostsentinel.com> wrote:
>         I've got this code snippet
>         
>         _newClientChannel.configureBlocking( true ) ;
>         writer.writeLine( "220 SAM ENS Console Proxy" ) ;
>         
>         if( response.startsWith( "myid " ) )
>         
>         If I telnet to the proxy server and after my telnet client
>         sees the 220 
>         above I do a kill -9 on the client the server will loop
>         forever on
>         read()
>         
>         strace shows this as fast as possible:
>         
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0 
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0 
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0 
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0 
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0 
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0 
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0
>         [pid  2222] read(13, "", 120)           = 0 
>         
>         Obviously this is happening inside of
>         
>         String response = reader.readLine( ) ;
>         
>         How do you protect against it?
>         
>         _______________________________________________
>         ajug-members mailing list
>         ajug-members at ajug.org
>         http://www.ajug.org/mailman/listinfo/ajug-members
> 




More information about the ajug-members mailing list