[ 
https://issues.apache.org/jira/browse/MCOMPILER-325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364526#comment-16364526
 ] 

Jake Robb commented on MCOMPILER-325:
-------------------------------------

Okay, I've researched, and I can't reproduce the problem. When we first 
encountered the problem, it was with Maven 3.1.1 and maven-compiler-plugin 3.1, 
running in Bamboo. Bamboo's build log is as follows (slightly obfuscated):
{code:java}
...
13-Feb-2018 15:56:49    [INFO] --- maven-compiler-plugin:3.1:testCompile 
(default-testCompile) @ project-name ---
13-Feb-2018 15:56:49    [INFO] Changes detected - recompiling the module!
13-Feb-2018 15:56:49    [INFO] Compiling 35 source files to 
/bamboo/bamboo-home/xml-data/build-dir/PROJ-PLAN-JOB/project-name/target/test-classes
13-Feb-2018 15:56:52    [INFO] 
------------------------------------------------------------------------
13-Feb-2018 15:56:52    [INFO] BUILD FAILURE
13-Feb-2018 15:56:52    [INFO] 
------------------------------------------------------------------------
13-Feb-2018 15:56:52    [INFO] Total time: 9.615s
13-Feb-2018 15:56:52    [INFO] Finished at: Tue Feb 13 15:56:52 EST 2018
13-Feb-2018 15:56:52    [INFO] Final Memory: 26M/724M
13-Feb-2018 15:56:52    [INFO] 
------------------------------------------------------------------------
13-Feb-2018 15:56:52    [ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile 
(default-testCompile) on project project-name: Compilation failure -> [Help 1]
13-Feb-2018 15:56:52    [ERROR]
13-Feb-2018 15:56:52    [ERROR] To see the full stack trace of the errors, 
re-run Maven with the -e switch.
13-Feb-2018 15:56:52    [ERROR] Re-run Maven using the -X switch to enable full 
debug logging.
13-Feb-2018 15:56:52    [ERROR]
13-Feb-2018 15:56:52    [ERROR] For more information about the errors and 
possible solutions, please read the following articles:
13-Feb-2018 15:56:52    [ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException{code}
But, when I compile my test project using the same version of Maven and the 
same version of the plugin, I get the following:
{code:java}
...
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ 
maven-compiler-plugin-bug ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. 
build is platform dependent!
[INFO] Compiling 2 source files to 
/Users/jrobb/Projects/maven-compiler-plugin-bug/target/test-classes


The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scanExpr(Flow.java:1634)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitApply(Flow.java:2258)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1382)
at com.sun.tools.javac.tree.TreeScanner.visitSelect(TreeScanner.java:264)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitSelect(Flow.java:2337)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1897)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1382)
[-- the following section repeats 1024 times --]
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scanExpr(Flow.java:1635)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitApply(Flow.java:2258)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1382)
at com.sun.tools.javac.tree.TreeScanner.visitSelect(TreeScanner.java:264)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitSelect(Flow.java:2337)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1897)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1382)
[-- end repeated section --]
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scanExpr(Flow.java:1635)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitApply(Flow.java:2258)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] An unknown compilation problem occurred
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.447s
[INFO] Finished at: Wed Feb 14 12:43:36 EST 2018
[INFO] Final Memory: 14M/113M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile 
(default-testCompile) on project maven-compiler-plugin-bug: Compilation failure
[ERROR] An unknown compilation problem occurred
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException{code}
Seeing this difference, my first thought was that Bamboo was dropping stderr. 
So I redirected stderr to /dev/null, yielding this:
{code:java}
...
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ 
maven-compiler-plugin-bug ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. 
build is platform dependent!
[INFO] Compiling 2 source files to 
/Users/jrobb/Projects/maven-compiler-plugin-bug/target/test-classes
[-- this is where the stderr stuff was]
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] An unknown compilation problem occurred
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.735s
[INFO] Finished at: Wed Feb 14 12:49:12 EST 2018
[INFO] Final Memory: 15M/109M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile 
(default-testCompile) on project maven-compiler-plugin-bug: Compilation failure
[ERROR] An unknown compilation problem occurred
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
{code}
So then I changed to Maven 3.5.0 and maven-compiler-plugin 3.7.0 and repeated 
the same steps. The resulting output is identical, with the expected exceptions 
(plugin versions, time taken, the exact stacktrace where it overflowed, and one 
added blank line before {{[ERROR] -> [Help 1]}}. 

I can't figure out why Bamboo's recorded output would be missing these lines:
{code}[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] An unknown compilation problem occurred
[INFO] 1 error
[INFO] -------------------------------------------------------------
{code}

And then later, again missing:
{code}
[ERROR] An unknown compilation problem occurred
{code}

Is there some argument, variable, or other condition that would cause Maven or 
the compiler plugin to omit that section?

> StackOverflowError from javac is not reflected in output
> --------------------------------------------------------
>
>                 Key: MCOMPILER-325
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-325
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 3.7.0
>            Reporter: Jake Robb
>            Priority: Minor
>
> Context: 
> [https://stackoverflow.com/questions/48775213/maven-compilation-error-without-any-errors-from-the-compiler]
> If the Java code being compiled contains a chain of method calls that is too 
> long to fit in javac's stack, javac will throw a StackOverflowError and exit.
> The resulting output indicates that javac errored, but does not show the SOE, 
> nor which source file caused it. (It'd be nice if it actually pointed out the 
> problem, but that's on javac, not on the Maven plugin.)
> For more recent versions of the plugin, if {{verbose=true}}, the plugin 
> output includes the files being compiled as they go, and so the last file 
> output is helpful, but it still doesn't indicate what went wrong. -X and -e 
> args to Maven are also not helpful.
> In my case, the failure occurred using default settings for stack size (I 
> think it's 1MB) when compiling a test case that chained together 673 builder 
> methods, e.g.
> {code:java}
> return new 
> MyBuilder().foo(a1).foo(a2).foo(...).foo(a672).foo(a673).build();{code}
> I assume this problem is not unique to StackOverflowErrors and would affect 
> any thrown Error from javac.
> The plugin should be updated to capture javac's error output and include it 
> when applicable.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to