You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Sappington, William" <Wi...@navteq.com> on 2007/12/31 05:19:00 UTC

[commons.net.FTP] new user, FTP Client times out on getReply()

Hi,

 

I'm using the FTP Client for an internal file distribution package and
am seeing some odd behavior.  I've written a butt simple test
application for measuring performance, and right now all it does is copy
a directory of files from the local file system to the server side, log
the size and transfer time of each file and the overall transfer time.
While running this test I noticed that the file transfer would pause for
several seconds, then resume, then pause again, over and over at
seemingly random intervals.  

 

I turned on verbose garbage collection and saw that the garbage
collector was not running at this time.  Looking at the file transfer
times I noticed that the delay was always almost exactly 5 seconds, the
value I had set for the reply timeout.  So from a separate terminal
window I issued a "kill -3" on the test app process when it paused and
got the following stack trace (snippet):

 

 

===== FULL THREAD DUMP ===============

Fri Dec 28 15:06:13 2007

BEA JRockit(R) R26.3.0-32-58710-1.5.0_06-20060308-2022-linux-x86_64

 

"Main Thread" id=1 idx=0x2 tid=9898 prio=5 alive, in native, waiting

    -- Waiting for notification on: java/lang/Object@0x2aaaaafe1fd0[fat
lock]

    at jrockit/vm/Threads.waitForSignal(J)Z(Native Method)

    at java/lang/Object.wait(J)V(Native Method)

    at org/apache/commons/net/ftp/FTP.snooze(I)V(FTP.java:306)

    ^-- Lock released while waiting: java/lang/Object@0x2aaaaafe1fd0[fat
lock]

    at org/apache/commons/net/ftp/FTP.__getReply()V(FTP.java:381)

    at
org/apache/commons/net/ftp/FTP.sendCommand(Ljava/lang/String;Ljava/lang/
String;)I(FTP.java:615)

    at
org/apache/commons/net/ftp/FTP.sendCommand(ILjava/lang/String;)I(FTP.jav
a:643)

    at
org/apache/commons/net/ftp/FTP.cwd(Ljava/lang/String;)I(FTP.java:869)

    at
org/apache/commons/net/ftp/FTPClient.changeWorkingDirectory(Ljava/lang/S
tring;)Z(FTPClient.java:725)

    at
com/traffic/filedistributor/libfilesender/FTPFileSender._ftpChangeDirect
ory(Lorg/apache/commons/net/ftp/FTPClient;Ljava/lang/String;)I(FTPFileSe
nder.java:1943)

 

It appears the client is waiting for a reply to the
changeWorkingDirectory() command, then times out, tries again (?),
completes it successfully (my program does not get an error returned to
it), and the transfers continue.

 

This happens randomly from every couple of seconds to maybe 10 or 15
seconds between occurrences, and happens in both active and passive
modes.  These tests are being done on pretty big boxes, 8-CPU, 3+ Ghz,
16 Gb memory, Redhat Linux.  My code is pretty simple, on initialization
I instantiate a client, connect, login, set the data and reply timeouts,
set file type to binary, and change directory to the destination
directory on the server (actually a tmp dir under the dest dir).  During
the file transfers I use storeFile() to put the file to a temporary
directory under the destination directory, then rename the file up to
the parent.  This is because the parent directory will be concurrently
read by another program.

 

Has anyone seen this before or have any ideas about what is going on?
I'm going to look deeper into what is happening at the server when I
return to the office, but I wanted to put the question out there in case
this was a known issue on the client side.  Thanks in advance for any
help, and if you need more detail, code snippets, whatever, please feel
free to ask.

 

-will