Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347040 - Race condition in AbstractHostShellOutputReader
Summary: Race condition in AbstractHostShellOutputReader
Status: NEW
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: unspecified   Edit
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: dsdp.tm.rse-inbox CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-24 14:32 EDT by Vladimir Prus CLA
Modified: 2011-06-20 03:24 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.