StackOverFlow exception

3 views
Skip to first unread message

Oldtimer

unread,
Sep 26, 2008, 10:04:36 AM9/26/08
to rocket-gwt
We are using GWT and a number of other packages including Rocket IoC
to develop a quite large application that will have hundreds of
screens and data objects. Rocket Ioc is one important piece of the
fundation architecture and allows us to expressively assemble screen
components together. It's been working fine for us. Thanks for this
great contribution to the community!

It has a not so small anoince lately, however. We started to get
StackOverflow in the development shell when we
click the Refresh or Compile/Browse buttons. We can launch the app
and compile to war no problem. The app runs fine in both Web and Host
modes.

The following exception message is taken from the shell after clicking
the Refresh button. The generator code seemed to get into a loop.
The stack trace is too long so I don't see where in the generator code
it started.


[ERROR] Unexpected problem whilst running generator for type
"com.bps.easm.app.client.context.EasmBeanFactory".
java.lang.StackOverflowError: null
at java.io.StringWriter.write(Unknown Source)
at java.io.StringWriter.write(Unknown Source)
at java.io.PrintWriter.write(Unknown Source)
at java.io.PrintWriter.write(Unknown Source)
at java.io.PrintWriter.print(Unknown Source)
at
com.google.gwt.user.rebind.ClassSourceFileComposer.print(ClassSourceFileComposer.java:
132)
at
com.google.gwt.user.rebind.ClassSourceFileComposer.print(ClassSourceFileComposer.java:
152)
at
com.google.gwt.user.rebind.ClassSourceFileComposer.print(ClassSourceFileComposer.java:
152)
at
com.google.gwt.user.rebind.ClassSourceFileComposer.print(ClassSourceFileComposer.java:
152)
at
com.google.gwt.user.rebind.ClassSourceFileComposer.print(ClassSourceFileComposer.java:
152)
...


We got a bit more from clicking on Compile/Browse:

[ERROR] Missing message: compilation_internalError in:
org.eclipse.jdt.internal.compiler.messages
rocket.generator.rebind.GeneratorException:
java.lang.StackOverflowError
at
rocket.generator.rebind.Generator.createNewTypeIfNecessary(Generator.java:
108)
at rocket.generator.rebind.Generator.generate(Generator.java:60)
at rocket.generator.rebind.Generator.generate(Generator.java:44)
at
com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:
51)
at com.google.gwt.dev.shell.StandardRebindOracle
$Rebinder.tryRebind(StandardRebindOracle.java:116)
at com.google.gwt.dev.shell.StandardRebindOracle
$Rebinder.rebind(StandardRebindOracle.java:61)
at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:
166)
at com.google.gwt.dev.GWTCompiler
$DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(GWTCompiler.java:
193)
at
com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:
128)
at com.google.gwt.dev.jdt.AbstractCompiler
$CompilerImpl.process(AbstractCompiler.java:150)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:
392)
at com.google.gwt.dev.jdt.AbstractCompiler
$CompilerImpl.compile(AbstractCompiler.java:84)
at com.google.gwt.dev.jdt.AbstractCompiler
$CompilerImpl.compile(AbstractCompiler.java:180)
at com.google.gwt.dev.jdt.AbstractCompiler$CompilerImpl.access
$400(AbstractCompiler.java:70)
at
com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:
493)
at
com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:
73)
at
com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.<init>(JavaToJavaScriptCompiler.java:
284)
at com.google.gwt.dev.GWTCompiler.distill(GWTCompiler.java:348)
at com.google.gwt.dev.GWTShell.compile(GWTShell.java:639)
at com.google.gwt.dev.GWTShell
$BrowserWidgetHostImpl.compile(GWTShell.java:220)
at com.google.gwt.dev.GWTShell
$BrowserWidgetHostImpl.compile(GWTShell.java:227)
at com.google.gwt.dev.shell.BrowserWidget
$Toolbar.widgetSelected(BrowserWidget.java:132)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:
90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:
3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)
Caused by: java.lang.StackOverflowError
at java.lang.AbstractStringBuilder.append(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
at java.io.StringWriter.write(Unknown Source)

We are using
GWT 1.5.2
Rocket 0.56
GWTDesigner 5.1

I am guessing it may have something to do with the order of the bean
declaration in the factory xml? But it works fine running the app.
Any clues?

Thanks.

Miroslav Pokorny

unread,
Sep 27, 2008, 6:12:11 PM9/27/08
to rocke...@googlegroups.com
Increase your stack , I can't remember the switch :)

Sent from my iPhone

Oldtimer

unread,
Sep 28, 2008, 8:51:04 AM9/28/08
to rocket-gwt

Now I am getting it in the host mode launch, and I have to do a clean
build almost everytime to get by. I need to look for that switch and
I assume it is a gwt launch command switch?

On Sep 27, 6:12 pm, Miroslav Pokorny <miroslav.poko...@gmail.com>
wrote:
> Increase your stack , I can't remember the switch :)
>
> Sent from my iPhone
>
> > Thanks.- Hide quoted text -
>
> - Show quoted text -

Oldtimer

unread,
Sep 28, 2008, 10:44:01 AM9/28/08
to rocket-gwt
That trick no longer works. It still compiles fine, but host mode
stops working due to the StackOverflow error. I can't find any switch
to increase the stack size in the shell. Can I run the debugger to
debug the generator during launch? I am using GWT Designer.
> > - Show quoted text -- Hide quoted text -

Miroslav Pokorny

unread,
Sep 28, 2008, 4:34:41 PM9/28/08
to rocke...@googlegroups.com
On Mon, Sep 29, 2008 at 12:44 AM, Oldtimer <yxzh...@gmail.com> wrote:

That trick no longer works.  It still compiles fine, but host mode
stops working due to the StackOverflow error.  I can't find any switch
to increase the stack size in the shell.  Can I run the debugger to
debug the generator during launch?  I am using GWT Designer.

Yes you can.
 

On Sep 28, 8:51 am, Oldtimer <yxzhao...@gmail.com> wrote:
> Now I am getting it in the host mode launch, and I have to do a clean
> build almost everytime to get by.  I need to look for that switch and
> I assume it is a gwt launch command switch?

Yes, try including the stacksize as an argument within the gwt args parameter...
 



--
mP

Oldtimer

unread,
Sep 29, 2008, 8:38:04 PM9/29/08
to rocket-gwt
mP:

No progress to report. Here is what's bothering me. Depending where
I set the break point within the
Generator.createNewTypeIfNecessary(...) method, the error does or does
not occur. It appears from the following block of code and the class
methods it calls

context.branch();
context.info("Assembling source for new type(s)...");
newType.write();
context.unbranch();

It is appearently in the place where the source code is generated and
writen out. You should be able to point that place. Due to this
random behavior, I start to wonder whether it has anything to do with
the I/O, which does not neccessary occur syncronized.

It is very much like my old days with C/C++ that errors didn't always
show up in the debugger. For now, I have to run code through debugger
with a "good" break point to get the host mode working.

My primary BeanFactory xml has 8 include files in it and has more to
come.

Colin

Miroslav Pokorny

unread,
Sep 30, 2008, 2:01:53 AM9/30/08
to rocke...@googlegroups.com
You might need to put a breakpoint or modify rocket.generator.rebind.Generator and paste the wrapped stacktrace etc.

} catch (final GeneratorException rethrow) {
rethrow.printStacktrace(); <-- insert this            

   context.error("Problem whilst running generator for type \"" + typeName + "\".", rethrow);
                throw rethrow;

            } catch (final Throwable caught) {
rethrow.printStacktrace(); <-- insert this

                context.error("Unexpected problem whilst running generator for type \"" + typeName + "\".", caught);
                throw new GeneratorException(caught);
            }

I dont know why you have tto do the breakpoint thing - seems very weird.
--
mP

Oldtimer

unread,
Sep 30, 2008, 11:35:35 PM9/30/08
to rocket-gwt
mP:

I resolved the issue by increasing the stacksize passing the jvm
parameter -Xss2M in the eclipse run configuration. The initial random
behavior turned persistent as I added more bean definitions to the
factory. I guess I was nearing the limit of the thread stack size.
Before I resolved the issue, the exception was coming from invoking
SourceWriter.commit() method in the NewConcreteOrInterfaceType.write()
method.

It appears to be that the generator does a large commit writting code
out at the end. It is understandable we need a stacksize larger than
the default (256k) when the factory contains large number of beans.
Maybe we should consider to flush at some mid points? Since code
generation happens in Host mode only, increase stacksize should have
no impact to Web mode.

Thanks for helping it out. Again, Rocket IoC is a great piece of
work.

Colin

On Sep 30, 2:01 am, "Miroslav Pokorny" <miroslav.poko...@gmail.com>
wrote:
> mP- Hide quoted text -

Miroslav Pokorny

unread,
Oct 1, 2008, 2:14:10 AM10/1/08
to rocke...@googlegroups.com
I don't believe it's a flushing as in too muvh stuff is being buffeted
problem . It appears to be purely a there's to many nested method
calls. I can't explain why hosted mode should really in the end be
different to a compile but at least you solved the problem :)

Sent from my iPhone

Reply all
Reply to author
Forward
0 new messages