You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2019/05/20 21:51:55 UTC

[Bug 63454] New: FTP still tries checking or entering directories after a timeout

https://bz.apache.org/bugzilla/show_bug.cgi?id=63454

            Bug ID: 63454
           Summary: FTP still tries checking or entering directories after
                    a timeout
           Product: Ant
           Version: 1.10.6
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Optional Tasks
          Assignee: notifications@ant.apache.org
          Reporter: eugene.adell@gmail.com
  Target Milestone: ---

When an FTP listing takes too much time and ends with a timeout, it is still
trying to check its current directory or to enter the next directory. This ends
with Ant sending an ugly packet to the FTP server when it should have stopped
working in a clean way. Moreover, the Exception logged is too much generic,
when we could inform the user of the failure cause.

ANT script for testing :

  <target name="listingWithSymlinks">
    <ftp action="list"
       listing="listingWithSymlinks.txt"
       server="ftp.ietf.org"
       port="21"
       remotedir="/rfc/bcp"
       userid="anonymous"
       password="anonymous" >
       <fileset dir="." defaultexcludes="no" includes="*" />
    </ftp>
  </target>

Exception :
BUILD FAILED/home/eadell/tests/ant-tests/project.xml:23: Unable to scan FTP
server:
..
Caused by: Error while communicating with FTP server:
..
Caused by: org.apache.commons.net.ftp.FTPConnectionClosedException: Connection
closed without indication.

Network trace :
20:38:35.916811 IP 185.47.63.113.37166 > 4.31.198.44.21: Flags [P.], seq
4556:4576, ack 17375, win 140, options [nop,nop,TS val 2848957056 ecr
328690075], length 20
E..H..@.@..../?q...,.....7..t........h.....
......i.CWD ../rfc7227.txt

20:38:36.085424 IP 4.31.198.44.21 > 185.47.63.113.37166: Flags [P.], seq
17375:17441, ack 4576, win 227, options [nop,nop,TS val 328690117 ecr
2848957056], length 66
EH.vP%@.-.:)...,./?q....t....7......L......
..i.....421 No transfer timeout (60 seconds): closing control connection

20:38:36.086606 IP 185.47.63.113.37166 > 4.31.198.44.21: Flags [P.], seq
4576:4581, ack 17441, win 140, options [nop,nop,TS val 2848957226 ecr
328690117], length 5
E..9..@.@..../?q...,.....7..t..T...........
...*..i.PWD

20:38:36.089454 IP 4.31.198.44.21 > 185.47.63.113.37166: Flags [F.], seq 17441,
ack 4576, win 227, options [nop,nop,TS val 328690119 ecr 2848957056], length 0
EH.4P&@.-.:j...,./?q....t..T.7......f......
..i.....
20:38:36.128258 IP 185.47.63.113.37166 > 4.31.198.44.21: Flags [.], ack 17442,
win 140, options [nop,nop,TS val 2848957268 ecr 328690119], length 0
E..4..@.@.."./?q...,.....7..t..U....f......
...T..i.
20:38:36.187110 IP 185.47.63.113.37166 > 4.31.198.44.21: Flags [FP.], seq
4581:5688, ack 17442, win 140, options [nop,nop,TS val 2848957326 ecr
328690119], length 1107
E.....@.@..../?q...,.....7..t..U....(p.....
......i.PWD
PWD
PWD
PWD
PWD
PWD
...
PWD
CDUP
QUIT

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63454] FTP still tries checking or entering directories after a timeout

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63454

Eugène Adell <eu...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |PatchAvailable

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63454] FTP still tries checking or entering directories after a timeout

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63454

Eugène Adell <eu...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eugene.adell@gmail.com

--- Comment #1 from Eugène Adell <eu...@gmail.com> ---
Created attachment 36593
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36593&action=edit
patch using FTPConnectionClosedException

catch org.apache.commons.net.ftp.FTPConnectionClosedException in the
isFunctioningAsDirectory methods, and bring it up to stop further tries. This
exception gives knowledge of the closed connection reason, which is clean.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63454] [PATCH] FTP still tries checking or entering directories after a timeout

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63454

J.M. (Martijn) Kruithof <jk...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |1.10.7

--- Comment #3 from J.M. (Martijn) Kruithof <jk...@apache.org> ---
Thank you very much, patch applied to
https://github.com/apache/ant/commit/382edda47687bf2eec6f65f0f17e29e81b7cf847

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63454] FTP still tries checking or entering directories after a timeout

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63454

--- Comment #2 from Eugène Adell <eu...@gmail.com> ---
After applying the patch, I get these results

Exception:
BUILD FAILED
/home/eadell/tests/ant-tests/project.xml:20: Error while communicating with FTP
server:
..
Caused by: org.apache.commons.net.ftp.FTPConnectionClosedException: FTP
response 421 received.  Server closed connection.


Network trace:
00:02:51.994103 IP 185.47.63.113.42105 > 4.31.198.44.21: Flags [P.], seq
4876:4881, ack 18478, win 140, options [nop,nop,TS val 2861213133 ecr
331754100], length 5
E..9G[@.@.0x./?q...,.y......C.'......a.....
......*tPWD

00:02:52.144179 IP 4.31.198.44.21 > 185.47.63.113.42105: Flags [P.], seq
18478:18544, ack 4881, win 227, options [nop,nop,TS val 331754138 ecr
2861213133], length 66
EH.v5.@.-.UM...,./?q...yC.'....3....]3.....
..*.....421 No transfer timeout (60 seconds): closing control connection

00:02:52.144211 IP 4.31.198.44.21 > 185.47.63.113.42105: Flags [F.], seq 18544,
ack 4881, win 227, options [nop,nop,TS val 331754138 ecr 2861213133], length 0
EH.45.@.-.U....,./?q...yC.(....3....w......
..*.....
00:02:52.146288 IP 185.47.63.113.42105 > 4.31.198.44.21: Flags [P.], seq
4881:4887, ack 18545, win 140, options [nop,nop,TS val 2861213286 ecr
331754138], length 6
E..:G\@.@.0v./?q...,.y.....3C.(......
.....
...f..*.QUIT


The client can now see the real Exception (421 response), and the network trace
looks cleaner without the abnormal concatenation of multiple PWDs + CDUP +
QUIT. It just tries a QUIT, which will be resetted by the server.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 63454] [PATCH] FTP still tries checking or entering directories after a timeout

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63454

Eugène Adell <eu...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|FTP still tries checking or |[PATCH] FTP still tries
                   |entering directories after  |checking or entering
                   |a timeout                   |directories after a timeout

-- 
You are receiving this mail because:
You are the assignee for the bug.