I use Apache's FTPClient to upload files to a FTP server.
However, even the FTP servers becomes unavailable while we upload a file, storeFile() hangs. storeFile() does not cancel the upload.
tcpdump trace:
22:04:29.584767 IP 10.84.78.2 > 192.168.114.2: ICMP 10.84.78.2 tcp port 53751 unreachable, length 142
Is there a way to set timeout? I already tried to use setSoTimeout() after connect() and setDataTimeout() before storeFile(). But this attributes seems to be irrelevant for this issue.
Thread dump, taken after FTP server is unavailable:
"Thread-1" prio=10 tid=0x00007f1a700f1800 nid=0x479b runnable [0x00007f1a76fea000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.write(Unknown Source)
- locked <0x00000000bb026df8> (a java.io.BufferedOutputStream)
at org.apache.commons.net.io.ToNetASCIIOutputStream.write(ToNetASCIIOutputStream.java:75)
- locked <0x00000000bb028e20> (a org.apache.commons.net.io.ToNetASCIIOutputStream)
at org.apache.commons.net.io.Util.copyStream(Util.java:111)
at org.apache.commons.net.ftp.FTPClient._storeFile(FTPClient.java:653)
at org.apache.commons.net.ftp.FTPClient.__storeFile(FTPClient.java:624)
at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:1976)
at ... (FTPClient.java:103)
at ... (Sender.java:67)
netstat -anpo output:
netstat -anpo | grep 192
tcp6 0 0 10.84.78.2:9011 192.168.114.2:21 VERBUNDEN 19310/java aus (0.00/0/0)
tcp6 0 201480 10.84.78.2:33088 192.168.114.2:20 VERBUNDEN 19310/java ein (10,26/2/0)