Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
364 views
in General by (120 points)
Hi

I am using edt ftp pro 5.2.1.

I use AsyncTransferClient with ftp connection pool. When i try rename operation on a server wihtout sufficient priviliges, number of connections to remote server exceeds the determined number. I checked connections with netstat command. I called blocking methods with java 8 parallelStreams. What may be the reason of this situation. Here is the sample code

AsyncFileTransferClient client = new AsyncFileTransferClient(1, 5);
        client.setRemoteHost("localhost");
        client.setProtocol(Protocol.FTP);
        client.setUserName("*");
        client.setPassword("*");
        client.connect();

        FTPFile files[] = client.directoryList();

        List<FTPFile> fileList = Arrays.asList(files);
        while (true) {
            fileList.parallelStream().forEach((t) -> {
                try {
                    client.rename(t.getName(), "." + t.getName());
                    client.downloadFile(t.getName(), "." + t.getName());
                } catch (FTPException ex) {
                    Logger.getLogger(FtpTEst.class.getName()).log(Level.SEVERE, null, ex);
                } catch (IOException ex) {
                    Logger.getLogger(FtpTEst.class.getName()).log(Level.SEVERE, null, ex);
                }
            });
        }

1 Answer

0 votes
by (2.7k points)
You're right!  There's definitely a bug there.  I replicated the behaviour described.  I also located the cause of the problem and a possible fix, but I need verify it with the person who developed it.  It should only happen if the rename and deleteDirectory operations are used.  Do you need a fix for this soon?
by (120 points)
Generally we do not encounter this case but when it happens the other clients cannot get connection due to connetion limits. I expect, it will be resolved as soon as possible.
by (2.7k points)
The bug is due to a race-condition and should only happen in highly concurrent cases where the delete-directory or rename operations are invoked.  We'll develop a fix soon.

Categories

...