commons-issues mailing list archives

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

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

Elliott Rabe commented on NET-3:
--------------------------------

It also appears to be possible to run into this bug in threaded mode.  It is possible for
the close method to set the threaded state to false while the reader is still active.  Under
these circumstances the same infinite loop is invoked.  I am also curious when the next build
will be happening so I can see if the patch fixes this situation as well.

> [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