Program does not response after IdFTP1->List()

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

LVL 2
UsurpatirusAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

George TokasCommented:
>>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
UsurpatirusAuthor Commented:
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
Morris_SzyslakCommented:
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
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

George TokasCommented:
>>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
UsurpatirusAuthor Commented:
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
George TokasCommented:
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
Morris_SzyslakCommented:
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
UsurpatirusAuthor Commented:
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
UsurpatirusAuthor Commented:
i migrate the code to non-service program, and it's crashed too.
0
Morris_SzyslakCommented:
Have you tried a TIdAntiFreeze in your Application?
0
George TokasCommented:
>>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
UsurpatirusAuthor Commented:
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
George TokasCommented:
>>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
UsurpatirusAuthor Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.