GWT compile stuck

226 views
Skip to first unread message

Alaa Humaidat

unread,
Feb 23, 2023, 9:14:03 AM2/23/23
to GWT Users
I'm working on upgrading an  app that uses GWT and embedded jetty server from java 8 to java 11. The app was working fine with jetty 9, GWT 2.10.0 before the upgrade. After upgrading to java 11- Jetty 11, the compilation for GWT got stuck.

I removed all unused dependencies, upgraded existing ones to their latest version (compatible with Java11), tried to increase Xmx and Xss for the compilation target, and tried to add workers, but nothing worked.

I used `jstack` to check the processes threads, which showed a deadlock (result attached).

Below is the ant target I'm using to build GWT:

```
<target name="compile.gwt" description="build applications" depends="compile">
        <java jvm="${home}/apps64/java11/bin/java" failonerror="true"
              classname="com.google.gwt.dev.Compiler"
              fork="true"
              output="build.log">
            <classpath>
                <path refid="local.class.path"/>
            </classpath>
            <jvmarg line="-Xmx1024M"/>
            <jvmarg line="-Xss16M"/>
            <arg value="-style"/>
            <arg value="DETAILED"/>
            <arg value="-localWorkers"/>
            <arg value="16"/>
            <arg value="-logLevel"/>
            <arg value="DEBUG"/>
            <arg value="-optimize"/>
            <arg value="5"/>
            <arg value="com.automation.core.ds"/>
        </java>
    </target>
```

How can I fix that?
GWT deadlock.pdf

Jonathan Baxter

unread,
Feb 23, 2023, 9:45:34 PM2/23/23
to GWT Users
Try changing localWorkers to 1?

Alaa Humaidat

unread,
Feb 23, 2023, 11:47:25 PM2/23/23
to GWT Users
Changing localWorkers to 1 didn't fix the issue (tried increasing them gradually as well). build.log doesn't show anything:
```
Public resources found in...
Translatable source found in...
Persistent unit cache dir set to: /home/ahumaidat/sourcegit/ds/gwt-unitCache
Opening cache file: /home/ahumaidat/sourcegit/ds/gwt-unitCache/gwt-unitCache-7b9fbb59f8661539c34f46974ce5fb573aac79fc-C90BB3B791D3293DB8D5BA1AB0A974D4-0000018681BB19A8
Looking for previously cached Compilation Units in /home/ahumaidat/sourcegit/ds/gwt-unitCache
Loaded 0 units from cache file: gwt-unitCache-7b9fbb59f8661539c34f46974ce5fb573aac79fc-C90BB3B791D3293DB8D5BA1AB0A974D4-000001867EC1D3D6
Loaded 0 units from cache file: gwt-unitCache-7b9fbb59f8661539c34f46974ce5fb573aac79fc-C90BB3B791D3293DB8D5BA1AB0A974D4-000001867EC29ADF
Loaded 0 units from cache file: gwt-unitCache-7b9fbb59f8661539c34f46974ce5fb573aac79fc-C90BB3B791D3293DB8D5BA1AB0A974D4-000001867ECC816B
Loaded 0 units from cache file: gwt-unitCache-7b9fbb59f8661539c34f46974ce5fb573aac79fc-C90BB3B791D3293DB8D5BA1AB0A974D4-000001867ED36467
Compiling module com.automation.core.ds
```

Thomas Broyer

unread,
Feb 24, 2023, 4:58:21 AM2/24/23
to GWT Users
This looks like a deadlock in JDK classes themselves. Did you try updating your JDK to the latest version? (11.0.18 AFAICT; 11.0.5 is more than 3 years old already)

Alaa Humaidat

unread,
Feb 24, 2023, 7:02:24 AM2/24/23
to GWT Users
Thank you, upgrading to java 11.0.18 fixed the issue, however, I got the following compilation error:
```
[ERROR] An internal compiler exception occurred
com.google.gwt.dev.jjs.InternalCompilerException: Unexpected operator for EqualExpression
at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.endVisit(GwtAstBuilder.java:762)
at org.eclipse.jdt.internal.compiler.ast.EqualExpression.traverse(EqualExpression.java:995)
at org.eclipse.jdt.internal.compiler.ast.IfStatement.traverse(IfStatement.java:329)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:437)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1699)
at com.google.gwt.dev.jjs.impl.GwtAstBuilder.processImpl(GwtAstBuilder.java:3969)
at com.google.gwt.dev.jjs.impl.GwtAstBuilder.process(GwtAstBuilder.java:4007)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$UnitProcessorImpl.process(CompilationStateBuilder.java:128)
at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.process(JdtCompiler.java:322)
at org.eclipse.jdt.internal.compiler.Compiler.processCompiledUnits(Compiler.java:575)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:475)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:1020)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:322)
at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:532)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:464)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:423)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:210)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:190)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:131)
at com.google.gwt.dev.Compiler.compile(Compiler.java:192)
at com.google.gwt.dev.Compiler.compile(Compiler.java:143)
at com.google.gwt.dev.Compiler.compile(Compiler.java:132)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:110)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
at com.google.gwt.dev.Compiler.main(Compiler.java:113)
   [ERROR] at Map.java(82): (value != null)
      org.eclipse.jdt.internal.compiler.ast.EqualExpression

```

Alaa Humaidat

unread,
Feb 26, 2023, 9:14:04 AM2/26/23
to GWT Users
Actually, after a few tries, I started getting compilation errors on all lines containing logical operators. For example, 
```
public void onClick(ClickEvent event) {
                    if ( ! selectedOptionsList.isEmpty()) {
                        repOptfPanel.clear();
                        for (String str : selectedOptionsList) {
                            Label label = new Label(str);
                            label.getElement().getStyle().setProperty("float", "left");
                            label.getElement().getStyle().setProperty("margin", "3px");
                            repOptfPanel.add(label);
                        }

                        ReprocessOptionsDialog.this.hide();
                    }
                }
```
doesn't compile due to the following error:
```
[ERROR] An internal compiler exception occurred
com.google.gwt.dev.jjs.InternalCompilerException: Unexpected operator for unary expression
at com.google.gwt.dev.jjs.impl.GwtAstBuilder$AstVisitor.endVisit(GwtAstBuilder.java:2377)
at org.eclipse.jdt.internal.compiler.ast.UnaryExpression.traverse(UnaryExpression.java:353)
at org.eclipse.jdt.internal.compiler.ast.IfStatement.traverse(IfStatement.java:329)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:411)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1765)
at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.traverse(QualifiedAllocationExpression.java:693)
at org.eclipse.jdt.internal.compiler.ast.MessageSend.traverse(MessageSend.java:1167)
at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.traverse(ConstructorDeclaration.java:708)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1831)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1683)

at com.google.gwt.dev.jjs.impl.GwtAstBuilder.processImpl(GwtAstBuilder.java:3969)
at com.google.gwt.dev.jjs.impl.GwtAstBuilder.process(GwtAstBuilder.java:4007)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$UnitProcessorImpl.process(CompilationStateBuilder.java:128)
at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.process(JdtCompiler.java:322)
at org.eclipse.jdt.internal.compiler.Compiler.processCompiledUnits(Compiler.java:575)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:475)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:1020)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:322)
at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:532)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:464)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:423)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:210)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:190)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:131)
at com.google.gwt.dev.Compiler.compile(Compiler.java:192)
at com.google.gwt.dev.Compiler.compile(Compiler.java:143)
at com.google.gwt.dev.Compiler.compile(Compiler.java:132)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:110)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
at com.google.gwt.dev.Compiler.main(Compiler.java:113)
   [ERROR] at ReprocessProductForm.java(324): (! selectedOptionsList.isEmpty())
      org.eclipse.jdt.internal.compiler.ast.UnaryExpression
```

while the following compiles successfully:
```
public void onClick(ClickEvent event) {
                    if ( selectedOptionsList.isEmpty()) {
                        repOptfPanel.clear();
                        for (String str : selectedOptionsList) {
                            Label label = new Label(str);
                            label.getElement().getStyle().setProperty("float", "left");
                            label.getElement().getStyle().setProperty("margin", "3px");
                            repOptfPanel.add(label);
                        }

                        ReprocessOptionsDialog.this.hide();
                    }
                }
```

The code above used to work fine when compiled using Java 8, GWT 2.10.

Alaa Humaidat

unread,
Feb 27, 2023, 12:11:31 PM2/27/23
to GWT Users
I was only able to fix the error above ecj from from apache-jsp per the suggestions here

```
<dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>apache-jsp</artifactId>
            <version>${jetty.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.jdt</groupId>
                    <artifactId>ecj</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
```

Michael Moser

unread,
Mar 6, 2023, 9:43:38 AM3/6/23
to google-we...@googlegroups.com

Hi and sorry - this is only indirectly a GWT question but since it’s heavily related with GWT someone might have already bumped into the same issue.

So I dare to ask it here – maybe someone in this group knows a work-around (so please bear with me!):

 

For 4 of our 5 projects using GWT we are still using the “classic” GWT 2.8 setup, i.e. with the “classic” plugin where one starts Jetty for development and debugging.

 

We recently had to upgrade a couple of POI libraries (an Apache library to generate Office documents from Java) and a few of those new jars obviously annotations that are not compatible with the Jetty-version used by the GWT 2.8 plugin.

 

“Not compatible” meaning, that Jetty during startup fails to scan those files for certain annotations in AnnotationConfiguration.scanForAnnotations (full error stack-trace below).

 

With Tomcat I had a similar (or identical?) issue but Tomcat offers a configuration option (in catalina.properties) to omit a list of jars from being scanned for Servlet annotations like so:

 

# Additional JARs (over and above the default JARs listed above) to skip when

# scanning for Servlet 3.0 pluggability features. These features include web

# fragments, annotations, SCIs and classes that match @HandlesTypes. The list

# must be a comma separated list of JAR file names.

# added by MMS: these contain an illegal byte tag (for Java 8) in their constants pool:

org.apache.catalina.startup.ContextConfig.jarsToSkip=\

log4j-api-2.17.2.jar,\

poi-5.2.3.jar,\

poi-ooxml-5.2.3.jar,\

poi-ooxml-lite-5.2.3.jar,\

xmlbeans-5.1.1.jar

 

This saved me with Tomcat. But with Jetty I had no luck so far to achieve something similar. This is now hindering our developer since they can’t run and debug the application locally anymore. I had planned to move that project to the new plugin and a local Tomcat only later this year.

Is there *any* way to teach Jetty to *not* do these Annotation scannings, either, or otherwise prevent these jars from being scanned?

 

 

The full error stacktrace:

 

...

00:00:11.874 [WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload@31419990{/,file:/D:/Projects/KStA_ZH_ZHQuest/code/application/zhquest-web/target/zhquest/,STARTING}{D:\Projects\KStA_ZH_ZHQuest\code\application\zhquest-web\target\zhquest}

org.eclipse.jetty.util.MultiException: Multiple exceptions

      at org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:536)

      at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:447)

      at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:479)

      at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1337)

      at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)

      at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)

      at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:550)

      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)

      at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)

      at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)

      at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)

      at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:140)

      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)

      at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)

      at org.eclipse.jetty.server.Server.start(Server.java:387)

      at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)

      at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)

      at org.eclipse.jetty.server.Server.doStart(Server.java:354)

      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)

      at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:760)

      at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:636)

      at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:923)

      at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:706)

      at com.google.gwt.dev.DevMode.main(DevMode.java:432) Caused by: org.eclipse.jetty.util.MultiException: Multiple exceptions

      at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:899)

      at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)

      at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)

      at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)

      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)

      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)

      at java.lang.Thread.run(Thread.java:748)

Caused by: java.lang.RuntimeException: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/Base64Util.class from jar file:/D:/Projects/KStA_ZH_ZHQuest/code/application/zhquest-web/target/zhquest/WEB-INF/lib/log4j-api-2.17.2.jar

      at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:913)

      at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)

      at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)

      at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)

      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)

      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)

      at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalArgumentException: null

      at org.objectweb.asm.ClassReader.<init>(Unknown Source)

      at org.objectweb.asm.ClassReader.<init>(Unknown Source)

      at org.objectweb.asm.ClassReader.<init>(Unknown Source)

      at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:973)

      at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956)

      at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909)

      at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)

      at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)

      at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)

      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)

      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)

      at java.lang.Thread.run(Thread.java:748)

 

Michael Moser

unread,
Mar 6, 2023, 10:14:03 AM3/6/23
to google-we...@googlegroups.com

In my last email I forgot to mention:

I had found this in the Jetty docs (https://www.eclipse.org/jetty/documentation/jetty-9/index.html#Other%20Configuration):

 


<?xml version="1.0" encoding="ISO-8859-1"?>

<Configure class="org.eclipse.jetty.webapp.WebAppContext">

      <Call name="setAttribute">

      <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>

            <Arg>.*/spring-[^/]*\.jar$</Arg>

      </Call>

</Configure>

 

According to the description this argument is intended to allow controlling which .jars on the classpath are being scanned for annotations (in the example above only jars that start with "spring-"), but unfortunately it had no effect in my case. The below error still appeared and Jetty doesn’t start up 

Thomas Broyer

unread,
Mar 6, 2023, 10:39:14 AM3/6/23
to GWT Users
Have you tried setting metadata-complete="true" on the <web-app> of your web.xml? It's supposed to disable annotation scanning AFAICT (but I don't remember how the JettyLauncher configures Jetty so maybe it bypasses this attribute).
Reply all
Reply to author
Forward
0 new messages