I have a ProFTPD FTP server (Version: 1.3.4d (maint)) that works fine for existing files but hangs until a "FTP no transfer timeout" occurs if a non-existing file is requested.
This is what I see in proftpd.log
when requesting a non-existing file:
May 20 12:05:04 myhost proftpd[25990] 1.2.3.4 (5.6.7.8[5.6.7.8]): FTP session opened.
May 20 12:05:04 myhost proftpd[25990] 1.2.3.4 (5.6.7.8[5.6.7.8]): USER system: Login successful.
...hangs for 10 Minutes....
May 20 12:15:04 myhost proftpd[25990] 1.2.3.4 (5.6.7.8[5.6.7.8]): Passive data transfer failed, possibly due to network issues
May 20 12:15:04 myhost proftpd[25990] 1.2.3.4 (5.6.7.8[5.6.7.8]): Check your PassivePorts and MasqueradeAddress settings,
May 20 12:15:04 myhost proftpd[25990] 1.2.3.4 (5.6.7.8[5.6.7.8]): and any router, NAT, and firewall rules in the network path.
May 20 12:15:04 myhost proftpd[25990] 1.2.3.4 (5.6.7.8[5.6.7.8]): FTP no transfer timeout, disconnected
May 20 12:15:04 myhost proftpd[25990] 1.2.3.4 (5.6.7.8[5.6.7.8]): ROOT PRIVS: unable to setegid(): Operation not permitted
May 20 12:15:04 myhost proftpd[25990] 1.2.3.4 (5.6.7.8[5.6.7.8]): RELINQUISH PRIVS: unable to seteuid(session.uid): Operation not permitted
May 20 12:15:04 myhost proftpd[25990] 1.2.3.4 (5.6.7.8[5.6.7.8]): FTP session closed.
These are the timeouts configured in proftpd.conf
:
TimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200
However, requests for existing files to the same server work fine.
Can anybody help me on this?
My problem is in the FTP client side, not the FTP server. I built a small FtpTester test tool and can reproduce the problem, which seems to be a bug in EnterpriseDT's edtFTPj FTP client. If you open an FTPInputStream on a non-existing file and close() it after receiving an IOException, the close() operating hangs until the socket timeout occurs.
I described this in detail on EnterpriseDT's web site, cf. http://enterprisedt.com/questions/index.php/11407/ftpinputstream-close-hangs-until-socket-timeout
I solved my problem with this workaround: Before opening an FTPInputStream I explicity check if the file exists.