Link to home
Start Free TrialLog in
Avatar of staleb
staleb

asked on

Ftp connection closed before filetransfer complete

Hi
I have an ssis package that sends file through ftp.
Sometimes the connection is closed before the file is transferred and then the file sent is empty the recipient reports.
Is this a problem with the sender or the receiving ftp-server?

Here is a log from the ftp server:

(005589) 12/20/2013 12:20:00 PM - (not logged in) (IP-address)> Connected, sending welcome message...
(005589) 12/20/2013 12:20:00 PM - (not logged in) (IP-address)> 220 [ftp-server name] FTP
(005589) 12/20/2013 12:20:00 PM - (not logged in) (IP-address)> USER netpark
(005589) 12/20/2013 12:20:00 PM - (not logged in) (IP-address)> 331 Password required for netpark
(005589) 12/20/2013 12:20:00 PM - (not logged in) (IP-address)> PASS [password]
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> 230 Logged on
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> TYPE A
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> 200 Type set to A
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> PORT 46,249,228,2,233,182
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> 200 Port command successful
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> LIST /output.txt
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> 550 Directory not found.
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> TYPE I
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> 200 Type set to I
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> PORT 233,183
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> 200 Port command successful
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> STOR /output.txt
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> 150 Opening data channel for file transfer.
(005589) 12/20/2013 12:20:00 PM - netpark (IP-address)> disconnected.


When its successful the last two lines is:

(005588) 12/20/2013 12:10:00 PM - netpark (IP-address)> 226 Transfer OK
(005588) 12/20/2013 12:10:00 PM - netpark (IP-address )> disconnected.
Avatar of Patrick Bogers
Patrick Bogers
Flag of Netherlands image

Hi

The logs look pretty normal which give me suspicion something is not correctly on the sender's side.
It shows the FTP server is opening a data channel and disconnects in one action without error.

I would (temporarely) install Wireshark on the FTP server and have it run a trace, this should give you a clear vision of what is happening.
Avatar of staleb
staleb

ASKER

I will have the company that holds the ftp server, run these tests on their server, when we go back to work tomorrow.
I just thought it was strange that there was an empty output.txt transferred, instead of no file.
Perhaps the server doesn't support the the client sending a partial PORT command.

The PORT command is normally 6 comma separated numbers.  The first 4 numbers are the IP address and the last 2 are the data port number.  

According to the log above, the client sent all 6 numbers in the initial PORT command but only the last 2 on the subsequent port command.  The server did report success of that second port command, but then could not connect on that port.

Another possibility, if 46.249.228.2 is the address of the firewall instead of the address of the actual client machine, then a protocol-aware firewall that snoops the control channel and parses PORT commands... that feature may not be doing port forwarding automatically on the fly when the PORT command is sent with only 2 numbers instead of 6.
Avatar of staleb

ASKER

Sorry for the late replay, the x-mas break went longer then expected.

If the server doesn't support sending partial PORT command, wouldn't it fail every time?.

Now it only fail sometimes. We send a file every 10min
In the log above it worked when the PORT command has all six numbers and did not work when it had only two.  

Since you are sending files all the time the next step is to get a longer log and check to see if the failures align with the short PORT command... also if there is a problem it could be a firewall issue rather than a server issue.  Many firewalls snoop the FTP control channel and then use that information to NAT the FTP data channel connection on-the-fly in real time.
Avatar of staleb

ASKER

Hi
Been cahnging/uppgrading the firewall on Our side to get better logging.
It didt help.
Also changed the trandfer to passiv mode

Here is an log With the first transfer failing (at 11:19)
The SSIS package reports success

782) 1/15/2014 11:19:06 AM - (not logged in) (IP-address)>Connected, sending welcome message...
(007782) 1/15/2014 11:19:06 AM - (not logged in) (IP-address)>220 Security park FTP
(007782) 1/15/2014 11:19:06 AM - (not logged in) (IP-address)>USER netpark
(007782) 1/15/2014 11:19:06 AM - (not logged in) (IP-address)>331 Password required for netpark
(007782) 1/15/2014 11:19:06 AM - (not logged in) (IP-address)> PASS ********
(007782) 1/15/2014 11:19:06 AM - netpark (IP-address)>230 Logged on
(007782) 1/15/2014 11:19:06 AM - netpark (IP-address)>TYPE A
(007782) 1/15/2014 11:19:06 AM - netpark (IP-address)>200 Type set to A
(007782) 1/15/2014 11:19:06 AM - netpark (IP-address)>PASV
(007782) 1/15/2014 11:19:06 AM - netpark (IP-address)>227 Entering Passive Mode (10,0,0,2,12,227)
(007782) 1/15/2014 11:19:06 AM - netpark (IP-address)>LIST /output.txt
(007782) 1/15/2014 11:19:06 AM - netpark (IP-address)>550 Directory not found.
(007782) 1/15/2014 11:19:06 AM - netpark (IP-address)>TYPE I
(007782) 1/15/2014 11:19:06 AM - netpark (IP-address)>200 Type set to I
(007782) 1/15/2014 11:19:06 AM - netpark (IP-address)>PASV
(007782) 1/15/2014 11:19:06 AM - netpark (IP-address)>227 Entering Passive Mode (10,0,0,2,12,228)
(007782) 1/15/2014 11:19:07 AM - netpark (IP-address)>STOR /output.txt
(007782) 1/15/2014 11:19:07 AM - netpark (IP-address)>150 Connection accepted
(007782) 1/15/2014 11:19:07 AM - netpark (IP-address)>disconnected.
(007783) 1/15/2014 11:39:06 AM - (not logged in) (IP-address)>Connected, sending welcome message...
(007783) 1/15/2014 11:39:06 AM - (not logged in) (IP-address)>220 Security park FTP
(007783) 1/15/2014 11:39:06 AM - (not logged in) (IP-address)>USER netpark
(007783) 1/15/2014 11:39:06 AM - (not logged in) (IP-address)>331 Password required for netpark
(007783) 1/15/2014 11:39:06 AM - (not logged in) (IP-address)>PASS ********
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>230 Logged on
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>TYPE A
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>200 Type set to A
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>PASV
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>227 Entering Passive Mode (10,0,0,2,12,252)
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>LIST /output.txt
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>550 Directory not found.
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>TYPE I
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>200 Type set to I
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>PASV
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>227 Entering Passive Mode (10,0,0,2,12,253)
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>STOR /output.txt
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>150 Connection accepted
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)>226 Transfer OK
(007783) 1/15/2014 11:39:06 AM - netpark (IP-address)> disconnected.
ASKER CERTIFIED SOLUTION
Avatar of AlexPace
AlexPace
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of staleb

ASKER

Yes it seems like the problem was on the ftp server. Thanx for the help