Solved

Program does not response after IdFTP1->List()

Posted on 2009-05-13
14
1,517 Views
Last Modified: 2013-12-14
My service FTP Client based on idFTP works fine, but randomly (its may runs normally one or two minutes, or may run 10-20 minutes) becomes unresponsible  after commands List and Get without any Exception or Error, it just sleep at background.
Passive mode is TRUE, TimeOuts does not helps.
Code is running in Timer every 30 secs:
IdFTP1->ConnectTimeout = 10000;

IdFTP1->Connect(var_update_server);

IdFTP1->ChangeDir(var_update_srvdir);

IdFTP1->List();

for (int i = 0; i < IdFTP1->ListResult->Count; i++) {

AnsiString s = IdFTP1->ListResult->Strings[i];

s.Delete(1,s.Pos("="));

 

if (s.SubString(s.Pos(" ")+1,s.Length()) == "1.cmd") {

 AnsiString temp_file_path = ExtractFilePath(ParamStr(0));

           IdFTP1->Get("1.cmd",                     //file

           temp_file_path+"1.cmd", //toFile

           true,    //overwrite

           false);  //resume

}

IdFTP1->Quit();

IdFTP1->Disconnect();

Open in new window

0
Comment
Question by:Usurpatirus
  • 6
  • 5
  • 3
14 Comments
 
LVL 16

Expert Comment

by:George Tokas
ID: 24378415
>>Code is running in Timer every 30 secs:
Looks like the timer ticks BEFORE the previous job finishes...
Timer->Enabled = 0;
//your code
Timer->Enabled = 1;
That means:
1. Disable the timer entering the handler...
2. Enable the timer exiting...

I hope that you have error handling code...
Inside there clear the ftp job if unfinnished and enable the timer..

George Tokas.
0
 
LVL 2

Author Comment

by:Usurpatirus
ID: 24381033
hi, first of all thanks for response.
Unfortunatly it doesn't help me, timer task is very short and connection is fast.
There are a logs:
14.05.2009 8:52:18	 RunTimer

14.05.2009 8:52:18	 TryServerConnect

14.05.2009 8:52:18	 IdFTP1Status: Connecting to 192.168.2.6.

14.05.2009 8:52:18	 IdFTP1Status: Connected.

14.05.2009 8:52:18	 IdFTP1Status: Connection established

14.05.2009 8:52:18	 IdFTP1Status: Starting FTP transfer

14.05.2009 8:52:18	 IdFTP1Status: Transfer complete

14.05.2009 8:52:19	 UpdateFromFtp

14.05.2009 8:52:19	 ReadSettingsFromIni

14.05.2009 8:52:19	 CheckCommandsFromFtp

14.05.2009 8:52:19	 IdFTP1Status: Disconnecting.

14.05.2009 8:52:19	 IdFTP1Status: Disconnected.
 

14.05.2009 8:52:29	 RunTimer

14.05.2009 8:52:29	 TryServerConnect

14.05.2009 8:52:29	 IdFTP1Status: Connecting to 192.168.2.6.

14.05.2009 8:52:29	 IdFTP1Status: Connected.

14.05.2009 8:52:29	 IdFTP1Status: Connection established

14.05.2009 8:52:29	 IdFTP1Status: Starting FTP transfer

14.05.2009 8:52:29	 IdFTP1Status: Transfer complete

14.05.2009 8:52:29	 UpdateFromFtp

14.05.2009 8:52:29	 ReadSettingsFromIni

14.05.2009 8:52:29	 CheckCommandsFromFtp

14.05.2009 8:52:29	 IdFTP1Status: Disconnecting.

14.05.2009 8:52:29	 IdFTP1Status: Disconnected.
 

14.05.2009 8:52:39	 RunTimer

14.05.2009 8:52:39	 TryServerConnect

14.05.2009 8:52:39	 IdFTP1Status: Connecting to 192.168.2.6.

14.05.2009 8:52:40	 IdFTP1Status: Connected.

14.05.2009 8:52:40	 IdFTP1Status: Connection established

14.05.2009 8:52:40	 IdFTP1Status: Starting FTP transfer

14.05.2009 8:52:40	 IdFTP1Status: Transfer complete

14.05.2009 8:52:40	 UpdateFromFtp

14.05.2009 8:52:40	 ReadSettingsFromIni

14.05.2009 8:52:40	 CheckCommandsFromFtp

14.05.2009 8:52:40	 IdFTP1Status: Disconnecting.

14.05.2009 8:52:40	 IdFTP1Status: Disconnected.
 

14.05.2009 8:52:50	 RunTimer

14.05.2009 8:52:50	 TryServerConnect

14.05.2009 8:52:50	 IdFTP1Status: Connecting to 192.168.2.6.

14.05.2009 8:52:40	 IdFTP1Status: Connected.

14.05.2009 8:52:40	 IdFTP1Status: Connection established

14.05.2009 8:52:41	 IdFTP1Status: Starting FTP transfer

//at this moment program is still running but does not response

Open in new window

0
 
LVL 2

Expert Comment

by:Morris_Szyslak
ID: 24382663
Some time ago I heard of a bug in some Indy versions regarding the List() method. I had the same problem, although with passive=false. I worked around by watching the progress of the List() with another timer and issuing an Abort() in case of a hangup. If the Abort() was executed then the List() would be retried. Same for the Get()'s.

Which version of Indy do you use? I believe the current dev snapshot versions don't show this hangup behavior.
0
 
LVL 16

Expert Comment

by:George Tokas
ID: 24383029
>>Unfortunatly it doesn't help me, timer task is very short and connection is fast.
This is a common mistake we do all the time...
Even though it could be true, is the server response ALLWAYS that fast...
I have some doubds since I used that for many years...

George Tokas.
0
 
LVL 2

Author Comment

by:Usurpatirus
ID: 24384774
2Morris_Szyslak passive is already false. Version is 10.2.5 (was installed with CodeGear RadStudio 2009). second timer does not helpes, program does not respotse to any commands.
2gtokas i'm currently disable timer before List task, but it's does not helps, program still ghosting on background.
0
 
LVL 16

Expert Comment

by:George Tokas
ID: 24386236
Even when aborting after timeout??
Looks a bit strange....
But those are the problems with services...
Try making a temporary standard win32 application, use the same code, and check out for any exceptions or memory inflation....

George Tokas.
0
 
LVL 2

Expert Comment

by:Morris_Szyslak
ID: 24392630
Well, the second timer should fire and execute the Abort(), even if the function call of the other timer is blocked by List() or Get(). At least that was the case with my Application. A service also, by the way.
0
Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

 
LVL 2

Author Comment

by:Usurpatirus
ID: 24392737
i'm upgrade indy to 10.5.5, useless.
ii'm use:
            Aborter->Enabled = true;
            dbruntime->IdFTP1->ChangeDir(var_update_srvdir);
            dbruntime->IdFTP1->List();
            Aborter->Enabled = false;
structure (Aborter is a second timer), but nothing. program is still dies.

now try to win32.

May be it's happens because server has drop transaction of List info, or disconnect, and indy does not correctly work with timeout?
0
 
LVL 2

Author Comment

by:Usurpatirus
ID: 24394198
i migrate the code to non-service program, and it's crashed too.
0
 
LVL 2

Assisted Solution

by:Morris_Szyslak
Morris_Szyslak earned 20 total points
ID: 24394404
Have you tried a TIdAntiFreeze in your Application?
0
 
LVL 16

Expert Comment

by:George Tokas
ID: 24394760
>>i migrate the code to non-service program, and it's crashed too.
So I was right about the stp server side....
Check out how to solve it and migrate it to the server...
BEFORE call List() enable a timeout timer.
If that timer ticks then abort all in ftp and set a time before start again...
If List() finishes before that timer ticks just disable the timer...

George Tokas.
0
 
LVL 2

Author Comment

by:Usurpatirus
ID: 24401317
2Morris_Szyslak no, i didn't try it. now will try, it just need to be placed on MainForm?
2gtokas i've been tried it, no luck
0
 
LVL 16

Assisted Solution

by:George Tokas
George Tokas earned 20 total points
ID: 24401727
>>2gtokas i've been tried it, no luck
Try create the idftp at runtime....
On failure DELETE and release resources and create again...
There is no way it can't be done....

George Tokas.
0
 
LVL 2

Accepted Solution

by:
Usurpatirus earned 0 total points
ID: 24439959
TAntiFreeze does not helps, may be i didn't properly install a Indy, or does not use TAntiFreeze correctly.
I'd prefer to use idFTP only once on form.
I rewrite code, and now using WinApi for my task.
Thank you for response, but it's useless.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

A few months ago I attended the Rocky Mountain IPv6 Summit which was a two-day educational event; it was the 3rd annual conference held here in Denver, Colorado that was held at the Hyatt Regency Denver at the Colorado Convention Center. It was an e…
Understanding FTPS File transfer is a common requirement in most Enterprises. While there are numerous ways to get a file from Point A to Point B over a network, perhaps the most common method still in use is FTP – File Transfer Protocol. FTP is …
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…

760 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

21 Experts available now in Live!

Get 1:1 Help Now