DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38688>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38688

           Summary: TelnetInputStream.read sometimes hangs if reader thread
                    is disabled
           Product: Commons
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Net
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


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 (bug #31122).

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
      {
        __queue.wait();
      }
      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.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to