Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336287

Summary: connection timeout reached although remote agent is available
Product: z_Archived Reporter: Robert Schuster <thebohemian>
Component: TPTPAssignee: Torsten Stolpmann <stolpmann>
Status: NEW --- QA Contact: Kathy Chan <kathy>
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
fix for the timeout problem none

Description Robert Schuster CLA 2011-02-03 16:01:06 EST
The following problem occured while using TPTP:

* we have amd64 Linux host systems running eclipse with TPTP
* there is a target system which is a 32bit Linux system - this one runs an agent controller (the agent controller connection command-line utility is able to connect to it nicely - locally [on the target itself] as well as from the remote hosts)

However: Whenever trying to connect to the agent controller via the Eclipse IDE it reports an error.

After debugging the plugin itself it was found out that when one single steps through the code lines that do the connection stuff, it works.

I investigated the problem further and found out that there is a race condition. There is a thread (A) which starts a second one (B) in order to establish the connection. A assumes that B's run() method is run sufficiently fast (after all it waits up to 10 seconds) and checks for return value from B. There are two problems here:
 * A does not wait until B is really run()
 * A does not make sure that the properties that have been set by B are really visible (I have to mention that all our host machines are multi-core).

What I observed is that the EstablishConnection.getException() and EstablishConnection.getConnection() returned 'null'. I added some code to those methods that makes sure that the EstablishConnection.run() method is really run() and reached the point where the properties have been set (implicitly this will also make sure the values are visible from other threads).

Attached is a patch that adds the neccessary locking to the connection setup code. With that code in place the connection to the remote host always succeeds and profiling the target works like a charm.

I know that TPTP is soon to be archived but a last release is planned. It would be great if this little one could go in.

Let me know if you need further information.
Comment 1 Kathy Chan CLA 2011-02-16 13:06:41 EST
Thank you for your time in isolating this problem!  I think you forgot to attach the patch.  Please attach your patch and we'll take a look.
Comment 2 Robert Schuster CLA 2011-02-16 13:14:48 EST
Created attachment 189123 [details]
fix for the timeout problem

Yeah somehow, I forgot the patch file. There it is. :)
Comment 3 Robert Schuster CLA 2011-02-28 04:57:19 EST
Now that 4.7.2 is out and this patch was not applied I have a question: Will there be another tptp bugfix release or is this the project's last state?
Comment 4 Kathy Chan CLA 2011-03-17 14:43:22 EDT
Unforturnately, the patch was attached too late in the TPTP 4.7.2 cycle (we were building the last RC on 02/16).

There's some recent discussion in the PMC level about future project plans, please stay tuned.  Any future TPTP releases will be announced to the distribution list and newsgroup.
Comment 5 Kathy Chan CLA 2011-04-11 10:02:25 EDT
Over to you, Torsten.