commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (NET-3) [net][PATCH] TelnetInputStream.read sometimes hangs if reader thread is disabled
Date Thu, 20 Sep 2007 05:26:13 GMT

     [ https://issues.apache.org/jira/browse/NET-3?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Henri Yandell reopened NET-3:
-----------------------------


> [net][PATCH] TelnetInputStream.read sometimes hangs if reader thread is disabled
> --------------------------------------------------------------------------------
>
>                 Key: NET-3
>                 URL: https://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.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message