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

Bug 347040

Summary: Race condition in AbstractHostShellOutputReader
Product: [Tools] Target Management Reporter: Vladimir Prus <vladimir.prus>
Component: RSEAssignee: dsdp.tm.rse-inbox <tm.rse-inbox>
Status: NEW --- QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Whiteboard:

Description Vladimir Prus CLA 2011-05-24 14:32:52 EDT
Build Identifier: 

This class has this code:

	protected final synchronized void startIfNotAlive() {
		if (!isAlive()) {
			start();
		}
	}

The problem is that isAlive() returns false both when the thread is not started yet, and when it's terminated. As result, I sometimes see situations where this method is called after the thread is terminated, and we get IllegalThreadStateException. The code on my client side is pretty boring:

			Object[] x = commands.runCommand(command,
				null, new SubProgressMonitor(monitor, 0));
	
			IServiceCommandShell shell = (IServiceCommandShell)x[0];
			IHostShell hostShell = shell.getHostShell();
			Process runtimeProcess = new HostShellProcessAdapter(hostShell);

Reproducible: Sometimes
Comment 1 Vladimir Prus CLA 2011-06-20 03:24:57 EDT
Ping?

I might be wrong, but it seems that the presence of a problem, at least, is fairly obvious -- and it would be great to agree on that, before talking about patches.