|Unexpected 50ms delay for all jobs [message #1017225]
||Mon, 11 March 2013 08:58
| Leung Wang Hei
Registered: July 2010
Job is often found to be executed exactly 50ms after the scheduling time.|
1. Create a plugin project with RCP application with a view template
2. Replace of the attached View.java
3. Double click at any table item and schedule the job for 1 second.
Here is the output:
1362985303755 --- schedule job in ms: 1000
1362985303755 job scheduled
1362985304805 job about to run
1362985304805 --- do job. Wait time=1050
Seems it is related to a 50 ms sleep in WorkerPool.startJob(Worker)
long hint = manager.sleepHint(); // return 0 if some jobs are waiting
job = manager.startJob();
//if we didn't sleep but there was no job available, make sure we sleep to avoid a tight loop (bug 260724)
if (hint <= 0 && job == null)
As said in bugzilla https://bugs.eclipse.org/bugs/show_bug.cgi?id=260724]:
If the startJob() returns null, it implies the wait queue is empty and there are no sleeping jobs that are ready to run. The only case I can think of this happening is if multiple threads are awake at once in this loop. If there was one job waiting, the sleep hint would be 0 for all threads, but then only one thread will pop the job from the queue and the others will get null.
I break at the sleep(50) line and found the following sequence, not exactly as described above:
1. Schedule job for 1000ms
2. WorkPool triggered after 1000ms
3. sleepHint=0, job=null >> sleep(50)
4. Next iteration in the while loop
5. sleepHint= -ve, job=actual job object
6. Job done. 50ms after the expected schedule time.
Setting priority and user, system flag gives no difference.
Is there some setting in Job and/or JobManager causing this issue?
(Size: 4.43KB, Downloaded 162 times)
[Updated on: Mon, 11 March 2013 09:00]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.01861 seconds