Hello,
My application synchronize files from a NAS 24/7 every 2min. After X
hours the application suddenly crashes/terminates. Sometimes we're able to log the
exception that occurse but not always(strange). "Connection to the FTP server's data channel
timed-out." The call to Synchronize is wrapped in try,catch blocks so i can't figure out why the application gets terminated other than some unhandled unmanagde stuff, our application don't use any. The application have been tested on 2 different FTP servers/ 2 different PC. It crasches on all configurations. On the server side it only logs sudden disconnects. Server and client is behind the same NAT so no firewall involved besides WinXP's.
Regards Andreas
Server log:
(012374) 2009-05-02 09:48:06 - rtlaka (192.168.10.175)> 250 CWD successful. "/Cad_Files" is current directory.
(012374) 2009-05-02 09:48:06 - rtlaka (192.168.10.175)> TYPE A
(012374) 2009-05-02 09:48:06 - rtlaka (192.168.10.175)> 200 Type set to A
(012374) 2009-05-02 09:48:06 - rtlaka (192.168.10.175)> PORT 192,168,10,175,12,56
(012374) 2009-05-02 09:48:06 - rtlaka (192.168.10.175)> 200 Port command successful
(012374) 2009-05-02 09:48:06 - rtlaka (192.168.10.175)> LIST
(012374) 2009-05-02 09:48:06 - rtlaka (192.168.10.175)> 150 Opening data channel for directory list.
(012374) 2009-05-02 09:48:06 - rtlaka (192.168.10.175)> 226 Transfer OK
(012373) 2009-05-02 09:48:36 - rtlaka (192.168.10.175)> QUIT
(012373) 2009-05-02 09:48:36 - rtlaka (192.168.10.175)> 221 Goodbye
(012373) 2009-05-02 09:48:36 - rtlaka (192.168.10.175)> disconnected.
(012374) 2009-05-02 09:48:36 - rtlaka (192.168.10.175)> disconnected.
Exception:
Error message:
An error occurred while creating a folder.
Type: Xceed.Ftp.FtpFolder
FullName: \Cad_Files\
Base exception:
Connection to the FTP server's data channel timed-out.
Stack trace:
at Xceed.FileSystem.AbstractFolder.GetFolders(FileSystemEvents events, Object userData, Boolean recursive, Object[] filters)
at Xceed.Synchronization.Synchronizer.SynchronizeFolder(SynchronizationEventsSession session, SynchronizationOptions options, Int32 masterItemIndex, FileSystemItem metaDataItem, Filter[] filters, IList folders, WorkArrayList workArrayList, WorkArrayList workIrrelevantItemIndexes, AbstractFolder folder, Int32 folderIndex, Hashtable processedContent, Boolean& abort)
at Xceed.Synchronization.Synchronizer.SynchronizeFolders(SynchronizationEventsSession session, SynchronizationOptions options, Int32 masterFolderIndex, FileSystemItem metaDataItem, WorkArrayList folders, WorkArrayList workIrrelevantItemIndexes, Filter[] filters)
at Xceed.Synchronization.Synchronizer.DoSynchronize(SynchronizationEventsSession session, SynchronizationOptions options, Int32 masterItemIndex, FileSystemItem metaDataItem, WorkArrayList workItems, WorkArrayList workIrrelevantItemIndexes, Filter[] filters)
at Xceed.Synchronization.Synchronizer.Synchronize(FileSystemEvents fileSystemEvents, Object fileSystemEventsUserData, SynchronizationEvents synchronizationEvents, Object synchronizationEventsUserData, SynchronizationOptions options, Int32 masterItemIndex, FileSystemItem metaDataItem, IList items, IList irrelevantItemIndexes, Filter[] filters)
at Xceed.Synchronization.Synchronizer.Synchronize(FileSystemEvents fileSystemEvents, Object fileSystemEventsUserData, SynchronizationEvents synchronizationEvents, Object synchronizationEventsUserData, FileSystemItem masterItem, SynchronizationOptions options, Filter[] filters, FileSystemItem[] items)
at FtpSynchronizeHandler.classFtpSynchronizeHandler.SyncRemoteToLocal(FtpConnection udtLocalFtpConnection, SynchronizationEvents udtSynchronizationEvents, FtpSynchronizeItem udtSyncItem)
FTP Connection snippet
Try
...
Dim ipRBABANas As New IPAddress(bytIPAddress)
Dim ipEndP As New IPEndPoint(ipRBABANas, 21)
udtLocalFtpConnection = New FtpConnection(ipEndP, strUserName, strPassWord)
udtLocalFtpConnection.PassiveTransfer = False
'call DoSynchronizeStuff
...
Catch ex As Exception
...
Finally
...
udtLocalFtpConnection.TraceWriter.Dispose()
udtLocalFtpConnection.Dispose()
End Try
Synchronize snippet
Try
...
' Test connection before trying to use it
udtLocalFtpConnection.TestConnection()
' Create folders to synchronize
Dim udtLocalFolder As AbstractFolder = New DiskFolder(udtSyncItem.LocalPath)
Dim udtRootFolder As New FtpFolder(udtLocalFtpConnection)
Dim udtRemoteFolder As AbstractFolder = udtRootFolder.GetFolder(udtSyncItem.RemotePath)
' Synchronize one-way from the remote folder
syncResult = Synchronizer.Synchronize(Nothing, Nothing, udtSynchronizationEvents, Nothing, udtRemoteFolder, _
udtSyncItem.SyncOptions, udtSyncItem.Filter, udtRemoteFolder, udtLocalFolder)
...
Catch ex As Exception
....
End Try