Bug 169943 - Stack overflow in Jobs API
Summary: Stack overflow in Jobs API
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 3.3 M5   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-09 04:59 EST by Richard Birenheide CLA
Modified: 2007-01-25 18:09 EST (History)
2 users (show)

See Also:


Attachments
A Plugin project to reproduce the problem (7.58 KB, application/x-zip-compressed)
2007-01-09 05:01 EST, Richard Birenheide CLA
no flags Details
Fix (1.26 KB, patch)
2007-01-25 18:08 EST, John Arthorne CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Birenheide CLA 2007-01-09 04:59:58 EST
Build ID: M20060921-0945

Steps To Reproduce:
1. Run the attached project as Eclipse application.
2. Hit the menu entry JobManagerLoad.
3. In the console, a stack overflow error is reported.


More information:
From the location where the error is thrown, I would conclude that the exclusion of jobs, which must not be performed in parallel (aka which are excluded via an appropriate rule) are somehow recursively scheduled for execution. If the number of jobs is more than the number of allowed stack traces, the error occurs.

Note that this has been discovered by a bug in the debug view decoration in Eclipse 3.2.0. The decoration had been defined as mutual exclusive job for each element in the debug view which led to the problem described. The respective coding has been changed with 3.2.1, but the underlying problem in the Jobs API still exists. From the coding I conclude a simple tail recursion which should be solvable with a while loop.
Comment 1 Richard Birenheide CLA 2007-01-09 05:01:46 EST
Created attachment 56618 [details]
A Plugin project to reproduce the problem
Comment 2 John Arthorne CLA 2007-01-18 11:54:57 EST
I can reproduce this, but I'm having a hard time finding the cause because I can't see the problematic stack (Bug 170558).  Do you know some trick to get it to show the stack trace for the thread with the stack overflow?
Comment 3 Richard Birenheide CLA 2007-01-19 01:54:40 EST
(In reply to comment #2)
> I can reproduce this, but I'm having a hard time finding the cause because I
> can't see the problematic stack (Bug 170558).  Do you know some trick to get it
> to show the stack trace for the thread with the stack overflow?

I am getting a stacktrace in the console view when starting a runtime workbench and hitting the menu entry. If that doesn't work for you try starting with -debug -consolelog. The design time as well as the runtime was started with -Xmx512m as jvm parameter.

Another way is to start the workbench in debug mode and to set an Exception breakpoint on StackOverFlowError, which shows the entire stack when stopping.

I should have posted the stacktrace nevertheless. Sorry for that. It is:

java.lang.StackOverflowError
	at org.eclipse.core.internal.jobs.InternalJob.addLast(InternalJob.java:116)
....

or the bottom frames from the debugger:
SampleAction$1(InternalJob).addLast(InternalJob) line: 116	
JobManager.nextJob() line: 827	
JobManager.startJob() line: 1102	
WorkerPool.startJob(Worker) line: 206	
Worker.run() line: 51	


Kindest Regards
Richard
Comment 4 John Arthorne CLA 2007-01-25 18:08:43 EST
Created attachment 57553 [details]
Fix

Switched tail recursion to iterative solution
Comment 5 John Arthorne CLA 2007-01-25 18:09:25 EST
Thanks, fix released.