Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
None
-
Operating System: Windows XP
Platform: PC
-
38688
Description
I'm trying to use TelnetClient with the reader thread disabled because I don't
want socket timeouts to fire during planned periods of inactivity (COM-1554).
But when the thread is disabled, I'm finding that TelnetInputStream.read
occassionally hangs when I try to read output from the server.
The problem appears to be the first while loop in __processChar, which looks
like this:
synchronized (__queue)
{
while (__bytesAvailable >= __queue.length - 1)
{
if(__threaded)
{
__queue.notify();
try
catch (InterruptedException e)
{ throw e; } }
...
}
If you get into this loop and the threaded flag is false, you are stuck
forever. That's what's happening in my case. If I suspend the thread, I can
see that (_bytesAvailable) is 2048 and (_queue.length -
1) is also 2048, so it's an infinite loop.
I'm not sure what triggers this, but it seems to happen most often when there
is a pause in server output or a pause before I initiate the next read.