You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Thomas Wolf (Jira)" <ji...@apache.org> on 2023/05/20 17:08:00 UTC

[jira] [Reopened] (SSHD-1310) SftpFileSystem.close() method, closes the session as well.

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

Thomas Wolf reopened SSHD-1310:
-------------------------------
      Assignee: Thomas Wolf

Re-opening.

Actually, yes, an {{SftpFileSystem}} is intended to be used in a session. But there are two cases:

# The {{SftpFileSystemProvider}} provides the file system. In that case, the session created by the {{SftpFileSystemProvider}} is owned by the {{SftpFileSystem}} and _must_ be closed when the file system is closed.
# Client code has already a {{ClientSession}} and creates the file system directly via {{SftpClientFactory.instance().createSftpFileSystem()}}. In that case the session _must not_ be closed when the {{SftpFileSystem}} is closed.

> SftpFileSystem.close() method, closes the session as well. 
> -----------------------------------------------------------
>
>                 Key: SSHD-1310
>                 URL: https://issues.apache.org/jira/browse/SSHD-1310
>             Project: MINA SSHD
>          Issue Type: Bug
>            Reporter: Tilden
>            Assignee: Thomas Wolf
>            Priority: Major
>
> SftpFileSystem.close() method, closes the session as well. 
> We expect only the sftpfilesystem channel to be closed.  Since we use the same session for multiple operations (exec command, SFTP download & upload, SFTP client list directory). 
>  
> SftpFileSystem.java 
>     public void close() throws IOException {
>         if (this.isOpen()) {
>             SftpFileSystemProvider provider = this.provider();
>             String fsId = this.getId();
>             SftpFileSystem fs = provider.removeFileSystem(fsId);
>             ClientSession session = this.getClientSession();
>             *session.close(true);*
>             if (fs != null && fs != this) {
>                 throw new FileSystemException(fsId, fsId, "Mismatched FS instance for id=" + fsId);
>             }
>         }
>     }
>  
>  
> can you please check and let us know, if this can be fixed  ?  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org