[ http://issues.apache.org/jira/browse/NET-3?page=all ]
Rory Winston closed NET-3. -------------------------- > [net][PATCH] TelnetInputStream.read sometimes hangs if reader thread is > disabled > -------------------------------------------------------------------------------- > > Key: NET-3 > URL: http://issues.apache.org/jira/browse/NET-3 > Project: Commons Net > Issue Type: Bug > Environment: Operating System: Windows XP > Platform: PC > Reporter: Rob Hasselbaum > Attachments: hanging_read_fix.patch > > > 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 > { > __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. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]