You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-dev@incubator.apache.org by "Rico Neubauer (JIRA)" <ji...@apache.org> on 2007/10/26 10:04:50 UTC

[jira] Created: (FTPSERVER-112) Connection is closed by remote server without waiting for client

Connection is closed by remote server without waiting for client
----------------------------------------------------------------

                 Key: FTPSERVER-112
                 URL: https://issues.apache.org/jira/browse/FTPSERVER-112
             Project: FtpServer
          Issue Type: Bug
          Components: Core
            Reporter: Rico Neubauer


FTP-Server is using MinaListener as listener class and the corresponding MinaFtpResponseOutput to write the replies.

When sending QUIT to the server, a reply "200 Goodbye." is send back and after that the connection is closed from the server. The problem here is that the reply is sent asynchronously and the connection is closed before this happen.

MinaFtpResponseOutput#write:
public void write(FtpReply response) throws IOException {
    session.write(response);
}

where session is IoSession interface. The following is the javadoc for this method:
Writes the specified message to remote peer. This operation is asynchronous;
{@link IoHandler#messageSent(IoSession, Object)} will be invoked when the message is actually sent to remote peer. You can also wait for the returned {@link WriteFuture} if you want to wait for the message actually written.

And in the end the Apache QUIT impl:
session.resetState();
out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_221_CLOSING_CONTROL_CONNECTION, "QUIT", null));   
connection.getServerContext().getConnectionManager().closeConnection(connection);

Bottom line: Before actually the client receives the reply, the connection is
closed. This is happening with certain FTP clients, e.g. FileZilla:
Command:        PWD
Response:       257 "/" is current directory.
Status:         Directory listing successful
Command:        quit
Error:          Disconnected from server 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FTPSERVER-112) Connection is closed by remote server without waiting for client

Posted by "Rico Neubauer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FTPSERVER-112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rico Neubauer updated FTPSERVER-112:
------------------------------------

    Attachment: apache-ftpserver-112-patch.patch

> Connection is closed by remote server without waiting for client
> ----------------------------------------------------------------
>
>                 Key: FTPSERVER-112
>                 URL: https://issues.apache.org/jira/browse/FTPSERVER-112
>             Project: FtpServer
>          Issue Type: Bug
>          Components: Core
>            Reporter: Rico Neubauer
>         Attachments: apache-ftpserver-112-patch.patch
>
>
> FTP-Server is using MinaListener as listener class and the corresponding MinaFtpResponseOutput to write the replies.
> When sending QUIT to the server, a reply "200 Goodbye." is send back and after that the connection is closed from the server. The problem here is that the reply is sent asynchronously and the connection is closed before this happen.
> MinaFtpResponseOutput#write:
> public void write(FtpReply response) throws IOException {
>     session.write(response);
> }
> where session is IoSession interface. The following is the javadoc for this method:
> Writes the specified message to remote peer. This operation is asynchronous;
> {@link IoHandler#messageSent(IoSession, Object)} will be invoked when the message is actually sent to remote peer. You can also wait for the returned {@link WriteFuture} if you want to wait for the message actually written.
> And in the end the Apache QUIT impl:
> session.resetState();
> out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_221_CLOSING_CONTROL_CONNECTION, "QUIT", null));   
> connection.getServerContext().getConnectionManager().closeConnection(connection);
> Bottom line: Before actually the client receives the reply, the connection is
> closed. This is happening with certain FTP clients, e.g. FileZilla:
> Command:        PWD
> Response:       257 "/" is current directory.
> Status:         Directory listing successful
> Command:        quit
> Error:          Disconnected from server 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (FTPSERVER-112) Connection is closed by remote server without waiting for client

Posted by "Niklas Gustavsson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FTPSERVER-112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niklas Gustavsson closed FTPSERVER-112.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0-M2
         Assignee: Niklas Gustavsson

Patch commited, thanks!

commit -m "Fix for closing connections before a reply has been sent (FTPSERVER-112). Patch by Rico Neubauer." C:/home/niklas/workspaces/apache/ftpserver/core/src/java/org/apache/ftpserver/listener/mina/FtpResponseEncoder.java
    Sending        home/niklas/workspaces/apache/ftpserver/core/src/java/org/apache/ftpserver/listener/mina/FtpResponseEncoder.java
    Transmitting file data ...
    Committed revision 588620.

> Connection is closed by remote server without waiting for client
> ----------------------------------------------------------------
>
>                 Key: FTPSERVER-112
>                 URL: https://issues.apache.org/jira/browse/FTPSERVER-112
>             Project: FtpServer
>          Issue Type: Bug
>          Components: Core
>            Reporter: Rico Neubauer
>            Assignee: Niklas Gustavsson
>             Fix For: 1.0-M2
>
>         Attachments: apache-ftpserver-112-patch.patch
>
>
> FTP-Server is using MinaListener as listener class and the corresponding MinaFtpResponseOutput to write the replies.
> When sending QUIT to the server, a reply "200 Goodbye." is send back and after that the connection is closed from the server. The problem here is that the reply is sent asynchronously and the connection is closed before this happen.
> MinaFtpResponseOutput#write:
> public void write(FtpReply response) throws IOException {
>     session.write(response);
> }
> where session is IoSession interface. The following is the javadoc for this method:
> Writes the specified message to remote peer. This operation is asynchronous;
> {@link IoHandler#messageSent(IoSession, Object)} will be invoked when the message is actually sent to remote peer. You can also wait for the returned {@link WriteFuture} if you want to wait for the message actually written.
> And in the end the Apache QUIT impl:
> session.resetState();
> out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_221_CLOSING_CONTROL_CONNECTION, "QUIT", null));   
> connection.getServerContext().getConnectionManager().closeConnection(connection);
> Bottom line: Before actually the client receives the reply, the connection is
> closed. This is happening with certain FTP clients, e.g. FileZilla:
> Command:        PWD
> Response:       257 "/" is current directory.
> Status:         Directory listing successful
> Command:        quit
> Error:          Disconnected from server 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.