[Date Prev] [Date Index] [Date Next] [Thread Prev] [Thread Index] [Thread Next]

Re: [SPAM] Re: [SPAM] Re: Console taking 100% CPU

Chris Fowler cfowler@outpostsentinel.com
Tue, 14 Dec 2010 22:33:52 GMT

On Tue, 2010-12-14 at 17:24 -0500, Thor Simon wrote:
> There is nothing "screwy" about read returning 0; it just means
> end-of-file 

Years back we had a problem with Java NIO not understanding that read of
0 = EOF.  If the user terminated the console client (written in Java as
a we applet) gracefully then everything was fine.  The problem we
experienced happened when the network went down or the connection was
lost.  Once the TCP keep alive failed then NIO would go into this nasty
select(), read(), select() loop just like his strace output.   Problem
was that the Java programmer was not a POSIX programmer and the strace
output that I gave him showing this was totally Greek.  He did
everything "by the NIO book".  In the end I "fired" that code and
replaced it with a Perl version.  I still use the console Java applet we
wrote but the web proxy is now in Perl.  The proxy is required because
Java applet security will only let you connect to the originating host.
Conserver is running on many embedded devices so the proxy's job is to
bridge communications from the web applet and the conserver program on
the device in the field.  It is little more than a select() loop on a
bunch of FD's.  It does update the database and log the communications
to a file.  

THAT is how I would have done it.  Problem is that it is a real pain to
do VT100 emulation great and putty does a much better job than I.