Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357653 - Synchronization in Spawner.waitFor() and Spawner.destroy() is problematic
Summary: Synchronization in Spawner.waitFor() and Spawner.destroy() is problematic
Status: RESOLVED INVALID
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 7.0.2   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Doug Schaefer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-14 11:49 EDT by Chris Recoskie CLA
Modified: 2013-10-28 12:55 EDT (History)
2 users (show)

See Also:


Attachments

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