commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 31272] New: - TelnetInputStream zombie thread memory leak, FTPClient TelnetClient
Date Fri, 17 Sep 2004 08:05:01 GMT
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: commons-dev@jakarta.apache.org
        ReportedBy: code@markj.net


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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message