Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Ftp connection closed before filetransfer complete

Posted on 2013-12-25
8
363 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 20

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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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 500 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

861 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