Support Questions

Find answers, ask questions, and share your expertise

ListSftp Processor closes connection?

avatar
New Contributor

Hello there,

I'm using nifi to retrieve files from an sftp server. This server grants multiple access to multiple users.

Nifi accesses the server as different users to dowload files.

It seems that ListSftp processor doesn't close connection, infact - having a maximum amount of connections per ip- i get a an acces error saying i reached maximum amount of connections per ip.

checking the source code, in

package org.apache.nifi.processors.standard.util.SFTPTransfer

in

getListing 

method

I cannot see any

close() 

request.

The only

close() 

method call i can see is in

getChannel 

method, but i guess this is not the case after listing content in sftp.

Is this a known issue, or am I missing something?

Thanks a lot for your help!

1 ACCEPTED SOLUTION

avatar
Master Guru

ListSFTP extends ListFileTransfer and that class has performListing() which does:

final FileTransfer transfer = getFileTransfer(context);
final List<FileInfo> listing;
try {
listing = transfer.getListing();
} finally {
IOUtils.closeQuietly(transfer);
}

The FileTransfer here is the SFTPTransfer, so it is being closed in a finally block every time.

View solution in original post

1 REPLY 1

avatar
Master Guru

ListSFTP extends ListFileTransfer and that class has performListing() which does:

final FileTransfer transfer = getFileTransfer(context);
final List<FileInfo> listing;
try {
listing = transfer.getListing();
} finally {
IOUtils.closeQuietly(transfer);
}

The FileTransfer here is the SFTPTransfer, so it is being closed in a finally block every time.