steffenschaefer/gwt-gradle-plugin

[gwt 2.7.0/gradle 2.12./plug-in 0.6] gwtSuperDev - java.lang.OutOfMemoryError

Opened this issue · 8 comments

Hi all,
I am trying to set-up a project structure like:

root---
            |       
            ---web-app
            |
            ---web-shared
            |
            ---web-server

The root build.gradle has:

subprojects {    
    apply plugin: 'java'
    buildscript {...}    
    repositories {...}
    ...
}
configure(subprojects.findAll {it.name == ":web-app" || it.name == ":web-shared"}) {    
    apply plugin: 'gwt'    
    gwt {    
        gwtVersion  "${gwt_version}"
        src       += files(project(':web-shared').sourceSets.main.allJava.srcDirs) 
                        + files(project(':web-shared').sourceSets.main.output.resourcesDir)    
        minHeapSize = "512M"
        maxHeapSize = "1024M"
        compiler {
            strict = true;
            optimize = "${gwt_compiler_optimize}";
            enableClosureCompiler = "${gwt_compiler_enableClosureCompiler}";
            style = "${gwt_compiler_style}";
            draftCompile = "${gwt_compiler_draftCompile}";
        }    
        superDev{ noPrecompile = true;}
    }
}

The idea is to inject in the 2 gwt children projects (web-app and web-shared) the common gwt configuration stuff, rather than duplicating it in each. web-app, therefore has only this in its build.gradle:

apply plugin: 'war'
apply plugin: 'gwt'
gwt {
    modules     "${gwt_xxx_app_modules}"
    devModules  "${gwt_xxx_app_modules}"
    gwtVersion  "${gwt_version}"
    src       += files(project(':web-shared').sourceSets.main.allJava.srcDirs) 
                      + files(project(':web-shared').sourceSets.main.output.resourcesDir)
}
dependencies {
        ...
        runtime project(":web-server")
        compile project(":web-shared")
}

This seem to work with normal compilation, e.g.:
gradlew --offline -g c:/temp/gradle -p web-app clean war
but superdev fails:
gradlew --offline -g c:/temp/gradle --no-daemon -p web-app gwtSuperDev

java.lang.OutOfMemoryError: GC overhead limit exceeded
        at com.google.gwt.dev.js.JsParser.map(JsParser.java:259)
        at com.google.gwt.dev.js.JsParser.mapExpression(JsParser.java:597)
        at com.google.gwt.dev.js.JsParser.mapObjectLit(JsParser.java:853)
        at com.google.gwt.dev.js.JsParser.map(JsParser.java:321)
        at com.google.gwt.dev.js.JsParser.mapExpression(JsParser.java:597)
        at com.google.gwt.dev.js.JsParser.mapReturn(JsParser.java:975)
        at com.google.gwt.dev.js.JsParser.map(JsParser.java:312)
        at com.google.gwt.dev.js.JsParser.mapStatement(JsParser.java:1029)
        at com.google.gwt.dev.js.JsParser.mapStatements(JsParser.java:1049)
        at com.google.gwt.dev.js.JsParser.mapBlock(JsParser.java:445)
        at com.google.gwt.dev.js.JsParser.mapFunction(JsParser.java:721)
        at com.google.gwt.dev.js.JsParser.map(JsParser.java:299)
        at com.google.gwt.dev.js.JsParser.mapStatement(JsParser.java:1029)
        at com.google.gwt.dev.js.JsParser.mapStatements(JsParser.java:1049)
        at com.google.gwt.dev.js.JsParser.mapStatements(JsParser.java:1063)
        at com.google.gwt.dev.js.JsParser.parseImpl(JsParser.java:138)
        at com.google.gwt.dev.js.JsParser.parse(JsParser.java:89)
        at com.google.gwt.dev.javac.JsniMethodCollector.parseJsniFunction(JsniMethodCollector.java:253)
        at com.google.gwt.dev.javac.JsniMethodCollector$Visitor.processMethod(JsniMethodCollector.java:155)
        at com.google.gwt.dev.javac.MethodVisitor.collectMethods(MethodVisitor.java:123)
        at com.google.gwt.dev.javac.MethodVisitor.access$000(MethodVisitor.java:33)
        at com.google.gwt.dev.javac.MethodVisitor$1.endVisit(MethodVisitor.java:64)
        at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1382)
        at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:745)
        at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:706)
        at com.google.gwt.dev.javac.MethodVisitor.collect(MethodVisitor.java:56)
        at com.google.gwt.dev.javac.JsniMethodCollector$Visitor.collect(JsniMethodCollector.java:144)
        at com.google.gwt.dev.javac.JsniMethodCollector.collectJsniMethods(JsniMethodCollector.java:174)
        at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$UnitProcessorImpl.process(CompilationStateBuilder.java:95)
        at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.process(JdtCompiler.java:384)
        at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:470)
        at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:985)
:web-app:gwtSuperDev FAILED

Any idea why gwtSuperDev fails like that? Note: If I copy and duplicate the entire gwt{...} from the root project, and copy-and-paste it into the 2 children gwt projects, everything starts to work.

Try giving it more heap memory. The error basically says all memory is gone and Garbage collection can not free anything.

Thanks. I will try your advice and see what happens. My concerns is that I am creating some infinite loop there, which is not present in the other case

Ok ... increasing the heap memory does not help - getSuperDev still crashes after taking a little more time. Running with --debug flag does not reveal anything useful either. I will try to change the examples in the distribution to see if my changes will exhaust the memory there as well. Again, this is only happening to superdev. The war task works?

Attached is a slimmed-down example that crashes with OutOfMemory every time
error.zip

Wow. That is a tiny project to OOM.

Is this still happening, or is it possible that this was a bug in a SNAPSHOT release?

One odd thing I noticed is both of your gwt.xml use the same rename-to. Not sure if that is part of the cause, but worth looking into.

James,
I abandoned Steffen's plugin some while ago. I use the one from Putnami now

/Hristo Stoyanov

On Aug 28, 2016 11:54 PM, "James Nelson" notifications@github.com wrote:

One odd thing I noticed is both of your gwt.xml use the same rename-to.
Not sure if that is part of the cause, but worth looking into.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#100 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFFIxHxZ6CC_FTgiaowoUMb86FCdnTIAks5qkoIfgaJpZM4H_hsA
.

Thx for heads up.