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

Bug 84127

Summary: [jobs] long running job blocks sleeping jobs
Product: [Eclipse Project] Platform Reporter: Bernhard Dorninger <bernhard.dorninger>
Component: RuntimeAssignee: platform-runtime-inbox <platform-runtime-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0.1   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Bernhard Dorninger CLA 2005-02-01 08:11:48 EST
I am scheduling a job with a delay (could also be more than one!), which are
enqueued in the Job Manager's sleeping queue.
Precondition: Only 1 WorkerThread available at the moment. This is the case on
startup or after over a minute inactivity since the last job
(WorkerPool.MIN_THREADS, BEST_BEFORE)

// SimpleJob does only forward the run command to a procmodel object's run
// which does some calculations
IProcModel mod=new FooProcModel();
Job myjob=new SimpleJob("FOOJOB",mod);
myjob.setPriority(Job.SHORT);
myjob.schedule(10000);

After that - and before the delay for the FooJob is over - I schedule another
job, this time without delay.

IProcModel mod=new BarProcModel("BAR");
Job myjob2=new SimpleJob("BARJob",mod);
myjob2.setPriority(SimpleJob.JOB_PRIO); // Prio is set to LONG
myjob2.schedule();

The worker pool assigns the only free worker to the BarJob. But the BarProcModel
contains some very long running calculation (e.g. 1-2 mins). Now the only
available worker is occupied and no one now regularly peeks into the sleeping
queue to see if there is any sleeping job to run.
When BarJob has finished, the FooJob(s) immediately is(are) scheduled. If BarJob
is badly behaved and gets frozen the FooJob never starts unless one schedules
another job.

PS: The error is also reproducable even if there are more than one worker
threads in the pool: schedule a job Foo with a delay and then make sure to
occupy all existing workers with long-running jobs. Foo will not earlier run as
soon as the first long running job finishes.
Comment 1 John Arthorne CLA 2005-02-03 10:42:18 EST

*** This bug has been marked as a duplicate of 82146 ***