Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Ftp connection closed before filetransfer complete

Posted on 2013-12-25
8
Medium Priority
?
369 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 23

Expert Comment

by:Patrick Bogers
ID: 39739135
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
ID: 39739784
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
ID: 39740220
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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

Author Comment

by:staleb
ID: 39764953
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
 
LVL 16

Expert Comment

by:AlexPace
ID: 39765466
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
ID: 39781941
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 2000 total points
ID: 39782954
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
ID: 39796601
Yes it seems like the problem was on the ftp server. Thanx for the help
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
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.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

876 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