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

x
?
Solved

Program does not response after IdFTP1->List()

Posted on 2009-05-13
14
Medium Priority
?
1,536 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
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
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…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

972 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