Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » FileTransferAgent - strange behaviour
FileTransferAgent - strange behaviour [message #116203] Tue, 23 October 2007 12:38 Go to next message
Jiri Bjalek is currently offline Jiri BjalekFriend
Messages: 12
Registered: July 2009
Junior Member
Hi everybody,
my problem concerns file transfer and delete operations in TPTP using
standart FileTransferAgent. I'm using TPTP 4.3.1 and AC 4.3.1 runnig java
1.5.0_12. I also tried AC 4.4.0.3 with the same results.


I've got sample code like this one:

INode node = NodeFactory.createNode("localhost");

ConnectionInfo cInfo = new ConnectionInfo();
cInfo.setHostName("localhost");
cInfo.setPort(port);

IAgentController ac = node.connect(cInfo);

IFileTransferManager fileTransferMgr = ac.getFileTransferManager();

fileTransferMgr.putFile(localFilePath, remoteFilePath);
fileTransferMgr.putFile(otherLocalFilePath, otherRemoteFilePath);

Thread.sleep(1000);
fileTransferMgr.deleteFile(remoteFilePath);
Thread.sleep(1000);
fileTransferMgr.deleteFile(otherRemoteFilePath);
Thread.sleep(1000);


After some experimenting with the code I added Thread.sleep(1000)
statements to get this running properly. Without this sleeps one or both
files were not deleted.

My problem is that I don't understand why it doesn't work without sleeping
the thread because I didn't find any info in docs or in examples about it.

Sometimes file transfer hangs up too and it seems to me that it could have
similar reasons.

Can you please provide me some explanation of this strange behaviour?

Thanks in advance.
Jiri Bjalek
Re: FileTransferAgent - strange behaviour [message #116265 is a reply to message #116203] Tue, 23 October 2007 15:04 Go to previous messageGo to next message
Igor Alelekov is currently offline Igor AlelekovFriend
Messages: 139
Registered: July 2009
Senior Member
Hi Jiri,
What API RAC/AC are you using?
(What packages are you importing in the sample?
org.eclipse.hyades.execution or org.eclipse.tptp.platform.execution?)
Regards,
igor
Re: FileTransferAgent - strange behaviour [message #116311 is a reply to message #116265] Wed, 24 October 2007 06:20 Go to previous messageGo to next message
Jiri Bjalek is currently offline Jiri BjalekFriend
Messages: 12
Registered: July 2009
Junior Member
Hi Igor,
I'm using standalone AC 4.3.1 and it runs on localhost. I'm connecting to
it on port 10006 (new interface I guess). And finally I'm importing
'org.eclipse.tptp.platform.execution' package in my sample.

Best regards,
Jiri
Re: FileTransferAgent - strange behaviour [message #116316 is a reply to message #116311] Wed, 24 October 2007 09:37 Go to previous messageGo to next message
Igor Alelekov is currently offline Igor AlelekovFriend
Messages: 139
Registered: July 2009
Senior Member
On what platform you are rinning AC 4.3.1?
Re: FileTransferAgent - strange behaviour [message #116321 is a reply to message #116316] Wed, 24 October 2007 09:55 Go to previous messageGo to next message
Jiri Bjalek is currently offline Jiri BjalekFriend
Messages: 12
Registered: July 2009
Junior Member
Windows XP SP2 (ENG), java 1.5.0_12
Re: FileTransferAgent - strange behaviour [message #116325 is a reply to message #116321] Wed, 24 October 2007 10:13 Go to previous messageGo to next message
Jiri Bjalek is currently offline Jiri BjalekFriend
Messages: 12
Registered: July 2009
Junior Member
Perhaps to be perfectly clear it is - Windows XP SP2 (ENG) - 32bit so I
downloaded AC 4.3.1 for WINDOWS-IA32 platform.
Re: FileTransferAgent - strange behaviour [message #116331 is a reply to message #116325] Wed, 24 October 2007 10:28 Go to previous messageGo to next message
Igor Alelekov is currently offline Igor AlelekovFriend
Messages: 139
Registered: July 2009
Senior Member
Why don't you try a modern TPTP AC build - 4.5, 4.4.1 or 4.4.0.3 instead
of using old 4.3.1?
Regards,
Igor
Re: FileTransferAgent - strange behaviour [message #116402 is a reply to message #116331] Fri, 26 October 2007 08:59 Go to previous messageGo to next message
Jiri Bjalek is currently offline Jiri BjalekFriend
Messages: 12
Registered: July 2009
Junior Member
Hi again,
after your suggestion I've tried new version of AC 4.4.0.3 and I've also
compiled my test code under TPTP 4.4.0.3 and I have to say that I get
exaxtly the same behaviour as with to older version 4.3.1. I've also tried
AC 4.5 and 4.4.1 again with the same result. I've even tried to write my
sample in c++ and once again there is need of inserting sleeps before
commands for file transfer which is quite non-deterministic for me. Do you
have another idea?

Best regards,
Jiri
Re: FileTransferAgent - strange behaviour [message #116407 is a reply to message #116402] Fri, 26 October 2007 11:07 Go to previous messageGo to next message
Igor Alelekov is currently offline Igor AlelekovFriend
Messages: 139
Registered: July 2009
Senior Member
Hi Jiri,
It seems this is a kind of race condition problem.
You are uploading a file and are deleting this file right away.
If it will be actual, I can investigate this after my vocation in two
weeks.
Regards,
igor
Re: FileTransferAgent - strange behaviour [message #116883 is a reply to message #116407] Wed, 31 October 2007 19:19 Go to previous messageGo to next message
Roman Smirak is currently offline Roman SmirakFriend
Messages: 136
Registered: July 2009
Senior Member
This answers sounds like the putFile() is an asynchronous method.

Than it also explain why it works with this wait()...

Can you Jiri discover that?

Roman

"Igor Alelekov" <igor.alelekov@intel.com> wrote in message
news:130772d525752afb0eb97fe124616a65$1@www.eclipse.org...
> Hi Jiri,
> It seems this is a kind of race condition problem.
> You are uploading a file and are deleting this file right away.
> If it will be actual, I can investigate this after my vocation in two
> weeks.
> Regards,
> igor
>
>
Re: FileTransferAgent - strange behaviour [message #116896 is a reply to message #116883] Thu, 01 November 2007 09:52 Go to previous messageGo to next message
Jiri Bjalek is currently offline Jiri BjalekFriend
Messages: 12
Registered: July 2009
Junior Member
Hi again,
I have yet another sample code which works bad for me. This sample is
based on code I've found in
http://www.eclipse.org/tptp/home/documents/resources/AC_Assi sted_File_Transfer.html
in chapter '3.2 Sample file transfer code'.

This time I experimented with C++ code instead of Java.

/*********************************************************** ********************
* Copyright (c) 2005 Intel Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* Contributors:
*
* Kevin P O'Leary, Intel - Sample of FileTransfer Client
*
* $Id: MyFileTransferClient.cpp,v 1.8 2005/11/07 18:51:18 koleary Exp $
*
*
************************************************************ *******************/

#include <iostream>
using namespace std;

#include "tptp/client/NodeFactory.h"
#include "tptp/client/FileTransfer.h"

using namespace TPTP::Client;

int main(int argc, char* argv[])
{
char* hostName = "localhost";
int portNum = 10006;
INode* TargetNode = 0;
AgentController* ACProxy = 0;

// Create a Node object for the target system of choice.
TargetNode = NodeFactory::createNode(hostName);
if (!TargetNode)
{
cout<<"ERROR: Failed to create the Node object."<<endl;
cout<<"Press any key to exit..."<<endl;
getchar();
return -1;
}

// Establish a connection with an Agent Controller on the
// target system. The port number specified must match
// that defined in the configuration file for the desired
// Agent Controller.
ACProxy = TargetNode->connect(portNum);

if (!ACProxy)
{
cout<<"ERROR: Unable to connect to the Agent Controller running on
"<<hostName<<" at port number "<<portNum<<endl;
cout<<"Press any key to exit..."<<endl;
getchar();
return -1;
}

cout<<endl<<"Connected to the Agent Controller on \""<<hostName<<"\" at
port number "<<portNum<<endl;

//End of generic connect to AgentController code.

//Start of FileTransferAgent specific code.
// Create a client-side representative of a FileTransfer object from which
// a MyFileTransferAgent is derived, specifying the name of the desired
agent
// as it has been installed in the agents directory.
FileTransfer* MyFileTransferAgent = new
FileTransfer("org.eclipse.tptp.FileTransferAgent");


// Get a handle to the actual FileTransferAgent, storing it in the
MyFileTransferAgent
// object. If the call is successful, the FileTransferAgent is running
and
// ready to respond to requests.
// Note that the Agent Controller manages the life of an agent, so it
will start
// one running if needed.
// We request controller access to the agent since we want to perform
// actions like getFile and putFile. However, the FileTransferAgent is
not checking
// access levels on incoming requests at this time (TBD).
if (-1 == ACProxy->getAgent(MyFileTransferAgent, TPTP_CONTROLLER_ACCESS))
{
cout<<"ERROR: Unable to get agent
org.eclipse.tptp.FileTransferAgent"<<endl;
cout<<"Press any key to exit..."<<endl;
getchar();
return -1;
}

cout<<endl<<"The FileTransferAgent Agent ID:
"<<MyFileTransferAgent->getAgentID()<<endl;

//These next variables encode the file paths for the transfered files.
#ifdef _WIN32
char *remoteFile = "C:\\tmp\\oi\\big_simple.txt"; //This is the
source file for getFile and putFile.
//char *localFile = "C:\\tmp\\big_local.txt"; //This is the
destination file for getFile and putFile.
char *localFile = "C:\\tmp\\oi1.txt"; //This is the
destination file for getFile and putFile.
char *remoteFile2 = "C:\\tmp\\oi\\big_simple2.txt"; //This is
the source file for getFile and putFile.
//char *localFile2 = "C:\\tmp\\big_local2.txt"; //This is the
destination file for getFile and putFile.
char *localFile2 = "C:\\tmp\\oi2.txt"; //This is the
destination file for getFile and putFile.
//Deleted by deleteFile operation.
#else
//other platform than win32 not used
#endif

tptp_int32 res;
for (int iter=0; iter<100000; iter++) {

cout << "Kolo: " << iter << endl;

cout << "putFile1 " << endl;
res = MyFileTransferAgent->putFile(localFile, remoteFile);
cout << "putFile2? " << res << endl;
cout << "putFile3 " << endl;
res = MyFileTransferAgent->putFile(localFile2, remoteFile2);
cout << "putFile4? " << res << endl;

cout << "deleteFile1 " << endl;
res = MyFileTransferAgent->deleteFile(remoteFile);
cout << "deleteFile2? " << res << endl;
cout << "deleteFile3 " << endl;
res = MyFileTransferAgent->deleteFile(remoteFile2);
cout << "deleteFile4? " << res << endl;
}

//Put the file specified in remoteFile to localFile.
//MyFileTransferAgent->putFile(remoteFile, localFile);
// Wait for data to finish coming over channel.
// Note: A protocol for recognizing end of data is TBD.
Sleep(2000);

// Release resources allocated by the Agent Controller
MyFileTransferAgent->destroyDataConnection();
MyFileTransferAgent->releaseAgent();
ACProxy->disconnect();

// Release client side resources
delete MyFileTransferAgent;
ACProxy->destroy();
NodeFactory::deleteNode(TargetNode);

cout << "This is the end :)" << endl;

return 0;
}


------------------------------------------------------------ --------------
Both files localFile and localFile2 have 16B in my case and after about
50000 iterations remote files are not replaced but the content is
appended. Transfered file has several kB instead of just 16B and the
content repeats several times.

Regards,
Jiri
Re: FileTransferAgent - strange behaviour [message #118485 is a reply to message #116896] Tue, 20 November 2007 08:51 Go to previous messageGo to next message
Jiri Bjalek is currently offline Jiri BjalekFriend
Messages: 12
Registered: July 2009
Junior Member
Hi again,
I'm still fighting with AC stuff. Lately I have created a test which runs
sample client - 'SampleClientAC.java' file found in CVS under
org.eclipse.tptp.platform.execution to omit all custom code.
I run this sample in loop for 500 iterations and it always stops working
after random number of iterations. Can someone give me some explanation or
confirm this as a bug?

Correct output:
********************** ITERATION 0 **********************
Connecting to Host localhost
Connecting to AC..
Connected to localhost at port number 10006






The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 0
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 1
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 2
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 3
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 4
Data Processor Waiting for Data Called


The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 5
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 6
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 7
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 8
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 9
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 10
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 11
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 12
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 13
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 14
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 15
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 16
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 17
The Data received from TimeCollector - Hello from pravdpav - Time
Collector Agent - Count 18
Data Processor Waiting for Data Called


Output when failed:
********************** ITERATION 368 **********************
Connecting to Host localhost
Connecting to AC..
Connected to localhost at port number 10006








Regards
Jiri
Re: FileTransferAgent - strange behaviour [message #118509 is a reply to message #118485] Tue, 20 November 2007 15:48 Go to previous messageGo to next message
Igor Alelekov is currently offline Igor AlelekovFriend
Messages: 139
Registered: July 2009
Senior Member
Hi Jiri,
It seems this is a defect caused by memory/threads leak in Agent
Controller.
Please open a bugzilla to track this.
Regards, Igor
Re: FileTransferAgent - strange behaviour [message #118871 is a reply to message #118509] Mon, 03 December 2007 06:28 Go to previous message
Jiri Bjalek is currently offline Jiri BjalekFriend
Messages: 12
Registered: July 2009
Junior Member
Hi Igor,
I was trying to reproduce this issue in 4.4.0.3 but it seems all right
there, so I stay with this version for now.

Regards
Jiri
Previous Topic:using perfmon without eclipse workbench
Next Topic:Recording Preference Dialog events
Goto Forum:
  


Current Time: Fri Apr 19 00:57:15 GMT 2024

Powered by FUDForum. Page generated in 0.02551 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top