• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 373
  • Last Modified:

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.
0
staleb
Asked:
staleb
  • 4
  • 3
1 Solution
 
Patrick BogersDatacenter platform engineer LindowsCommented:
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.
0
 
stalebAuthor Commented:
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.
0
 
AlexPaceCommented:
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.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
stalebAuthor Commented:
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
0
 
AlexPaceCommented:
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.
0
 
stalebAuthor Commented:
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.
0
 
AlexPaceCommented:
The server's PASV response includes an private 10.x.x.x IP address.  

The response is invalid unless your FTP client is in the same private network.  

This is a common server configuration error... so common in fact that some FTP clients automatically ignore privately IP addresses in a PASV response and instead automatically substitute the IP addressed used for the initial connection.  

I'm not sure if the FTP stack used by SSIS is able to restrict the data connection to the same IP address used for the control connection.  If not, your other options are to ask the server administrator to fix his PASV response so it shows a public IP address instead of a private address or to use a different FTP client software to do this transfer.
0
 
stalebAuthor Commented:
Yes it seems like the problem was on the ftp server. Thanx for the help
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now