Community
Participate
Working Groups
Created attachment 216839 [details] Test case Wrong implementation of ISchedulingRule interface that wraps around some basic rule can result in two threads running concurrently with the same rule, although the basic rule would not allow them to be run at the same time. "Wrong implementation" in this case means that the rule does not adhere to the following statement from the javadoc of ISchedulingRule#isConflicting: "This method must return true if calling contains(ISchedulingRule) on the same rule also returns true. This is required because it would otherwise allow two threads to be running concurrently with the same rule." See the attached test case for a sample implementation. The problem is that when we already obtained a rule, we can obtain other rules that are contained within that rule without additional validation being performed. In the original scenario that I found, I was able to schedule two jobs with the workspace root rule at the same time, and that in turn allowed me to perform two simultaneous workspace.save(..) operations (which is one of the potential root causes of bug 149121). At the moment none of the ISchedulingRule implementations is safe enough, to allow us to say that it will definitely be run only by one thread at the same time.
Created attachment 217012 [details] Patch v.0.1 The attached patch fixes the problem by rejecting a rule that cannot be safely added to the stack of rules. A test is also added.
http://git.eclipse.org/c/platform/eclipse.platform.runtime.git/commit/?id=2d6e94e8ac1415af460dcfcac5901a5e9edfe146
We used the same branch for 4.1 M1 and 4.2.1, so these changes are actually in 4.2.1 as well.
Verified in M20120829-1200.