Bug 406829 - Race condition in IJobManagerTest.testJobFamilyWakeUp
Summary: Race condition in IJobManagerTest.testJobFamilyWakeUp
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 4.3   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 4.3 RC1   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on:
Blocks: 51538
  Show dependency tree
 
Reported: 2013-04-29 13:37 EDT by John Arthorne CLA
Modified: 2013-05-14 07:49 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2013-04-29 13:37:56 EDT
The test case IJobManagerTest.testJobFamilyWakeUp has a race condition that causes the test to fail incorrectly. Here is the current code:

if (family1[i].getState() == Job.RUNNING)
	runningCount++;
else
	assertState("7.1." + i, family1[i], Job.WAITING);

The intent is to verify that the job is either waiting or running. However, there are two calls to job.getState(). If the job is still waiting when getState() is called the first time, we enter the else block. At this point the job starts running, and the assertion fails because it expects waiting.  We can see from the failure message that this is what happened:

7.1.0: expected state: WAITING actual state: RUNNING 

It is perfectly valid that the job is running here, we just have a badly written test.
Comment 2 Dani Megert CLA 2013-04-30 11:02:27 EDT
Verified in I20130430-0031.
Comment 3 Dani Megert CLA 2013-05-13 10:24:26 EDT
Looks like this was not all of it. Failed again in I20130511-1500:

http://download.eclipse.org/eclipse/downloads/drops4/I20130511-1500/testresults/html/org.eclipse.core.tests.runtime_macosx.cocoa.x86_5.0.html
Comment 4 John Arthorne CLA 2013-05-13 10:54:50 EDT
Difference occurrence of the same bad pattern. Fixed:

http://git.eclipse.org/c/platform/eclipse.platform.runtime.git/commit/?id=4982b24a410823d36e2a49fcad28d68d8e55a7c2
Comment 5 Dani Megert CLA 2013-05-14 07:49:19 EDT
Verified in I20130513-2000.