Bug 47414 - [PATCH] Add Ftp ant task timeout
Summary: [PATCH] Add Ftp ant task timeout
Alias: None
Product: Ant
Classification: Unclassified
Component: Optional Tasks (show other bugs)
Version: unspecified
Hardware: All All
: P3 enhancement with 6 votes (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Keywords: PatchAvailable
Depends on:
Reported: 2009-06-24 02:22 UTC by Chuchi
Modified: 2019-07-12 14:10 UTC (History)
1 user (show)

patch introducing a reading timeout for FTP (3.04 KB, patch)
2019-03-01 22:14 UTC, Eugène Adell
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chuchi 2009-06-24 02:22:55 UTC
I have a lot of problems with the FTP timeout because we run a lot of ant tasks using the ftp and, if one stops by a infinite timeout, all the next task will never run.

FtpClient supports the timeout, IMO only adding a timeout property to FTP task is ok because in the code is very easy fix this problem.
Comment 1 Leo Sauermann 2011-06-21 15:26:41 UTC
I am working with Ant FTP to transfer (GET) files from a website. To minimize traffic, the depends="yes" and retriesAllowed="5" is set. Still, the ant ftp task hangs on some files and the task does not continue. The script hangs (for hours, days). 

Assuming that this problem is related to timeouts, I also would love to see this feature implemented. 

There are reported implementations (as a "hack"):
Comment 2 Eugène Adell 2019-03-01 22:14:52 UTC
Created attachment 36473 [details]
patch introducing a reading timeout for FTP

the attachment is in text format

Short Description
Introduce a read timeout, then receiving files which look infinite will not hang anymore. Sending is not concerned, as timeout will already occur if necessary.

It should be tested seriously, as FTP is not the most simple thing, and because we rely on external library (commons-net).
My tests are OK for now, but maybe do you have servers to test against.

What the patch does :
 . Introduce the dataTimeout as suggested by a comment, which will make impossible any infinite reading (described as 'FTP hangs' by many)
 . Call the abort command when the timeout is detected, then the server will be notified it should stop sending the current file. This abort is not sent in any urgent mode as described by RFC 959, as the commons-net doesn't support this feature yet. Although the effects are unsure since all servers are not implemented the same way, this feature is here to be compliant with the RFC.
Comment 3 J.M. (Martijn) Kruithof 2019-07-12 14:10:58 UTC
Patch as provided manually verified and applied. I also updated the docs