You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mark Ford (JIRA)" <ji...@apache.org> on 2016/05/29 19:14:12 UTC

[jira] [Updated] (NET-592) plainSocket in FTPSClient is never closed

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

Mark Ford updated NET-592:
--------------------------
    Description: 
The plainSocket field in the FTPSClient is never closed. Over time, this will lead to an IOException with "too many open files".

To recreate this, try the following in a loop:

- create an FTPSClient
- call the login
- upload a file
- download the file
- call logout
- disconnect within a finally block

I would expect the disconnect call would release all of the file descriptors but if you set a breakpoint you'll notice that this socket remains open.

In my test driver, this eventually fails after 8,000 iterations until it hits the max file descriptors for the test process. 

If I use some reflection code and force FTPSClient.plainSocket to be accessible so I can close it, then everything works. 

  was:
The plainSocket field in the FTPSClient is never closed. Over time, this will lead to an IOException with "too many open files".

To recreate this, try the following in a loop:

- create an FTPSClient
- call the login
- upload a file
- download the file
- disconnect within a finally block

I would expect the disconnect call would release all of the file descriptors but if you set a breakpoint you'll notice that this socket remains open.

In my test driver, this eventually fails after 8,000 iterations until it hits the max file descriptors for the test process. 

If I use some reflection code and force FTPSClient.plainSocket to be accessible so I can close it, then everything works. 


> plainSocket in FTPSClient is never closed
> -----------------------------------------
>
>                 Key: NET-592
>                 URL: https://issues.apache.org/jira/browse/NET-592
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.4, 3.5
>            Reporter: Mark Ford
>            Priority: Critical
>
> The plainSocket field in the FTPSClient is never closed. Over time, this will lead to an IOException with "too many open files".
> To recreate this, try the following in a loop:
> - create an FTPSClient
> - call the login
> - upload a file
> - download the file
> - call logout
> - disconnect within a finally block
> I would expect the disconnect call would release all of the file descriptors but if you set a breakpoint you'll notice that this socket remains open.
> In my test driver, this eventually fails after 8,000 iterations until it hits the max file descriptors for the test process. 
> If I use some reflection code and force FTPSClient.plainSocket to be accessible so I can close it, then everything works. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)