gwt-gradle-plugin icon indicating copy to clipboard operation
gwt-gradle-plugin copied to clipboard

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

Open hrstoyanov opened this issue 8 years ago • 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.

hrstoyanov avatar Apr 04 '16 21:04 hrstoyanov

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

jnehlmeier avatar Apr 05 '16 09:04 jnehlmeier

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

hrstoyanov avatar Apr 05 '16 15:04 hrstoyanov

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?

hrstoyanov avatar Apr 05 '16 16:04 hrstoyanov

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

hrstoyanov avatar Apr 17 '16 01:04 hrstoyanov

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?

JamesXNelson avatar Aug 29 '16 06:08 JamesXNelson

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.

JamesXNelson avatar Aug 29 '16 06:08 JamesXNelson

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" [email protected] 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 https://github.com/steffenschaefer/gwt-gradle-plugin/issues/100#issuecomment-243045851, or mute the thread https://github.com/notifications/unsubscribe-auth/AFFIxHxZ6CC_FTgiaowoUMb86FCdnTIAks5qkoIfgaJpZM4H_hsA .

hrstoyanov avatar Aug 29 '16 15:08 hrstoyanov

Thx for heads up.

JamesXNelson avatar Sep 02 '16 08:09 JamesXNelson