Skip to content

Commit

Permalink
Fix "Terminate and Relaunch" of groups that use adoptIfRunning #1318
Browse files Browse the repository at this point in the history
This was a race condition:
RuntimeProcess.fTerminated was only set asynchronously, hindering
relaunching the process, thinking it was already running.

Happened only for GroupLaunchElement.adoptIfRunning == true

fixes
#1318
  • Loading branch information
EcljpseB0T authored and jukzi committed May 27, 2024
1 parent abad786 commit b52f606
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,12 @@ public void terminate() throws DebugException {
try { // (in total don't wait longer than TERMINATION_TIMEOUT)
long waitStart = System.currentTimeMillis();
if (process.waitFor(TERMINATION_TIMEOUT, TimeUnit.MILLISECONDS)) {
int exitValue = process.exitValue();
synchronized (this) {
fExitValue = process.exitValue();
fExitValue = exitValue;
// synchronously remember thread is terminated
// before later asynchronously done in terminated():
fTerminated = true;
}
if (waitFor(descendants, waitStart)) {
return;
Expand Down

0 comments on commit b52f606

Please sign in to comment.