Community
Participate
Working Groups
Created attachment 208159 [details] Hello World example of the issue We have an issue that blocks processing of an application. It turns out that the job manager does not activate (run) a scheduled job after the specified time, even more it never starts it at all. We traced it down to the job scheduling framework in JobManager. That made it possible to create a hello world example. Just open it in a workspace and launch the products/hello.product The hello world is attached and does the following: Main: schedule job A Main: schedule job C A: schedule job B and join on it B: do sleep until a stop flag is set to true. C: set the stop flag Even more, all jobs scheduled after A (has started running) are never run and awakened. Therefore i added some info jobs that just say hello. In order to not wait forever, i added a sleep 2000 after which it breaks up waiting in the main thread. When calling IJobManager.resume at that point, it magically awakenes all ready-to-run jobs and runs them. But the javadoc says that calling resume() does nothing when the job manager is active. Expected behaviour: I expect that whenever scheduling a Job say schedule(200) it is run after 200 ms +/- some acceptable delay. Never running it is breaking the concept of having parallel jobs in a system.
Addendum: When i run it in debug mode, it only happens in 60% of the launches. When i run it in run model it happens in 95% of the launches. When i add a loop in the start method to call the process n times, it only happen in 1% of the cases. So i guess there might be some timing issue that is greater, the less system delays are used (debug, jm profiling etc.)
Addendum: tested it also on Platforms win xp and macosx, as well as eclipse 3.6.2 and had the same effect.
In case you need help in the analysis of the cause of this effect, just give me a note.
Wow, I can reproduce this easily. It is a case of starvation because there are no idle worker threads and both of the existing worker threads are blocked. The conditions to reproduce seem to be: - Start with only one existing worker thread - Jobs A and C are scheduled with a delay. There is an idle worker thread so nothing is spawned - Job A causes Job B to be scheduled. This spawns a new worker thread. - Job B starts. Usually immediately before starting a job, a worker checks to make sure there is at least one more worker available if there are waiting jobs. However since C is still sleeping it doesn't spawn a new worker -> Now A and B are running, and there are no idle workers to process C when its time comes.
Fix, and regression test based on Ivan's example. http://git.eclipse.org/c/platform/eclipse.platform.runtime.git/commit/?id=7c6740abca3b0243a4a745665df56d4372a1e16d