Solved

Ftp connection closed before filetransfer complete

Posted on 2013-12-25
8
358 Views
Last Modified: 2016-02-10
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
Comment
Question by:staleb
  • 4
  • 3
8 Comments
 
LVL 19

Expert Comment

by:Patricksr1972
Comment Utility
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
 

Author Comment

by:staleb
Comment Utility
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
 
LVL 16

Expert Comment

by:AlexPace
Comment Utility
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
 

Author Comment

by:staleb
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 16

Expert Comment

by:AlexPace
Comment Utility
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
 

Author Comment

by:staleb
Comment Utility
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
 
LVL 16

Accepted Solution

by:
AlexPace earned 500 total points
Comment Utility
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
 

Author Closing Comment

by:staleb
Comment Utility
Yes it seems like the problem was on the ftp server. Thanx for the help
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

My client sends data in an Excel file to me to load them into Staging database. The file contains many sheets that they have same structure. In this article, I would like to share the simple way to load data of multiple sheets by using SSIS.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now