Net:FTP hanging

I have an odd situation occurring with Net::FTP.

My code looks something like:

ftp = FTP.open(host)
ftp.passive
ftp.login(user, password)
ftp.putbinaryfile(filename)

The ftp.putbinaryfile line ends up hanging. Doing an lsof for the
process shows the command channel established and the data channel is a
CLOSE_WAIT state. From what I understand this means the application
hasn't acknowledged the closed channel. Digging through the ruby code
all I can see is a loop where the the socket is written to before it is
finally closed. Once it gets into C code I'm lost.

Once in this state the ruby code doesn't finish and I have to manually
kill -9 the process. Using SystemTimer to set a timeout is also
effective but not very practical - some of the transfers can take hours
to run so the timeout has to be large.

So, any ideas why this is happening?

I'm on ruby 1.8.7p299

ยทยทยท

--
Posted via http://www.ruby-forum.com/.