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

Bug 357653

Summary: Synchronization in Spawner.waitFor() and Spawner.destroy() is problematic
Product: [Tools] CDT Reporter: Chris Recoskie <recoskie>
Component: cdt-coreAssignee: Project Inbox <cdt-core-inbox>
Status: RESOLVED INVALID QA Contact: Doug Schaefer <cdtdoug>
Severity: major    
Priority: P3 CC: aleherb+eclipse, jamesblackburn+eclipse
Version: 7.0.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Chris Recoskie CLA 2011-09-14 11:49:48 EDT
I've run into this problem... this is an over-simplification of the scenario (the local builders do not exhibit this problem), but it illustrates the issue.

Thread 1:
- my builder uses the spawner to create an external process to run make
- the builder then does a waitFor() on the make process to know when the build is done, and update the progress accordingly

Thread 2:
- Request comes in from user to cancel the process.
- Attempt to do Spawner.destroy() is blocked because Thread 1 holds the lock on the Spawner in waitFor()

I don't think destroy() should ever by synchronized.  You should be able to kill a given process no matter what state it's in;  it's your last resort against something that's running amok.  Having it synchronized means you are forced to wait for it to complete if anyone anywhere is waiting for it to complete.
Comment 1 Anton Leherbauer CLA 2011-09-15 04:32:48 EDT
Please attach a thread dump of affected threads.
In Spawner.waitFor() I would assume that most of the time is spent in wait() and while the thread waits, other threads can enter the monitor, so this should work IMO.
Comment 2 Chris Recoskie CLA 2013-10-28 12:55:02 EDT
Closing as invalid.