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=31272>.
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=31272

TelnetInputStream zombie thread memory leak, FTPClient TelnetClient

           Summary: TelnetInputStream zombie thread memory leak, FTPClient
                    TelnetClient
           Product: Commons
           Version: Nightly Builds
          Platform: HP
        OS/Version: HP-UX
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Net
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


If myFTPClient.setReaderThread(false) and many ftp clients are instanciated 
over time, the VM gets out of memory errors. The problem is that the underlying 
TelnetClient's TelnetInputStream creates a new thread that it never uses (never 
starts, or joins). The VM is unable to garbage collect these zombie threads. 
This problem is paticularly notable given that several users have observed 
hangs doing continual ftp unless setReaderThread(false). This observed on hpux 
jdk 1.3 <todo lookup specific version>

Here's a patch:

cvs server: Diffing src/java/org/apache/commons/net/telnet
Index: src/java/org/apache/commons/net/telnet/TelnetClient.java
===================================================================
RCS file: /home/cvspublic/jakarta-
commons/net/src/java/org/apache/commons/net/telnet/TelnetClient.java,v
retrieving revision 1.12
diff -r1.12 TelnetClient.java
100,101c100
< 
<         tmp = new TelnetInputStream(input, this);
---
>         tmp = new TelnetInputStream(input, this, readerThread);
Index: src/java/org/apache/commons/net/telnet/TelnetInputStream.java
===================================================================
RCS file: /home/cvspublic/jakarta-
commons/net/src/java/org/apache/commons/net/telnet/TelnetInputStream.java,v
retrieving revision 1.11
diff -r1.11 TelnetInputStream.java
56c56
<     TelnetInputStream(InputStream input, TelnetClient client)
---
>     TelnetInputStream(InputStream input, TelnetClient client, boolean 
readerThread)
72c72,74
<         __thread = new Thread(this);
---
>         if (readerThread) {
>             __thread = new Thread(this);
>         }
76a79
>         if (__thread==null) { return; }
498c501
<             if (__thread.isAlive())
---
>             if (__thread!=null && __thread.isAlive())

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

Reply via email to