Getting stackoverflow error after groovy and gradle upgrade

After gradle udgrade to 7.4 and groovy to 4.0.17 I am getting stackoverflow error.
Can anyone tell me are these versions compatible with each other.

Full stacktrace -

java.lang.StackOverflowError
	at org.codehaus.groovy.ast.ClassNode.hashCode(ClassNode.java:719)
	at java.base/java.util.HashMap.hash(HashMap.java:338)
	at java.base/java.util.HashMap.getNode(HashMap.java:568)
	at java.base/java.util.HashMap.containsKey(HashMap.java:594)
	at java.base/java.util.Collections$UnmodifiableMap.containsKey(Collections.java:1500)
	at org.codehaus.groovy.classgen.asm.util.TypeUtil.isPrimitiveType(TypeUtil.java:99)
	at org.codehaus.groovy.ast.ClassHelper.isPrimitiveType(ClassHelper.java:379)
	at org.codehaus.groovy.ast.ClassNode.getPlainNodeReference(ClassNode.java:1520)
	at org.codehaus.groovy.ast.ClassNode.getPlainNodeReference(ClassNode.java:1531)
	at org.codehaus.groovy.ast.tools.GenericsUtils.newClass(GenericsUtils.java:318)
	at org.codehaus.groovy.ast.tools.GenericsUtils.makeClassSafe0(GenericsUtils.java:332)
	at org.codehaus.groovy.ast.tools.GenericsUtils.makeClassSafeWithGenerics(GenericsUtils.java:352)
	at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:442)
	at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:371)
	at org.codehaus.groovy.ast.tools.GenericsUtils.extractSuperClassGenerics(GenericsUtils.java:561)
	at org.codehaus.groovy.ast.tools.GenericsUtils.parameterizeType(GenericsUtils.java:294)
	at org.codehaus.groovy.ast.tools.GeneralUtils.addAllInterfaces(GeneralUtils.java:479)
	at org.codehaus.groovy.ast.tools.GeneralUtils.addAllInterfaces(GeneralUtils.java:479)
	at org.codehaus.groovy.ast.tools.GeneralUtils.addAllInterfaces(GeneralUtils.java:479)
	at org.codehaus.groovy.ast.tools.GeneralUtils.addAllInterfaces(GeneralUtils.java:479)
	at org.codehaus.groovy.ast.tools.GeneralUtils.getInterfacesAndSuperInterfaces(GeneralUtils.java:486)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:422)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:210)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
1 Like

Where do you get that error, and what is the bottom of the stacktrace?

We have a monolith application with some modules in groovy and one of the module is throwing this exception while gradle build.
Recent changes are we have upgraded our JAVA version from 11 to 17 and groovy to 3.0.10 to 4.0.17 along with gradle 7.4.
This is the entire stacktrace that we are getting. Gradle command that I am using is - gradle build --full-stacktrace

Sending the stacktrace again -

Cause: java.lang.StackOverflowError
	at java.base/java.util.HashMap.hash(HashMap.java:338)
	at java.base/java.util.HashMap.getNode(HashMap.java:568)
	at java.base/java.util.HashMap.containsKey(HashMap.java:594)
	at java.base/java.util.Collections$UnmodifiableMap.containsKey(Collections.java:1500)
	at org.codehaus.groovy.classgen.asm.util.TypeUtil.isPrimitiveType(TypeUtil.java:99)
	at org.codehaus.groovy.ast.ClassHelper.isPrimitiveType(ClassHelper.java:379)
	at org.codehaus.groovy.ast.ClassNode.getPlainNodeReference(ClassNode.java:1520)
	at org.codehaus.groovy.ast.ClassNode.getPlainNodeReference(ClassNode.java:1531)
	at org.codehaus.groovy.ast.tools.GenericsUtils.newClass(GenericsUtils.java:319)
	at org.codehaus.groovy.ast.tools.GenericsUtils.makeClassSafe0(GenericsUtils.java:333)
	at org.codehaus.groovy.ast.tools.GenericsUtils.makeClassSafeWithGenerics(GenericsUtils.java:353)
	at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:443)
	at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:372)
	at org.codehaus.groovy.ast.tools.GenericsUtils.extractSuperClassGenerics(GenericsUtils.java:562)
	at org.codehaus.groovy.ast.tools.GenericsUtils.parameterizeType(GenericsUtils.java:294)
	at org.codehaus.groovy.ast.tools.GeneralUtils.addAllInterfaces(GeneralUtils.java:479)
	at org.codehaus.groovy.ast.tools.GeneralUtils.addAllInterfaces(GeneralUtils.java:479)
	at org.codehaus.groovy.ast.tools.GeneralUtils.getInterfacesAndSuperInterfaces(GeneralUtils.java:486)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:422)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:210)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:238)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:276)
	........

The last two lines repeated there after

The last two lines repeated there after

But not eternally, there must be a start that is different.

Can you share a build --scan?

No actually no stacktrace is there.

Using - build – scan

== BUILD FAILED ==

Execution failed for task ‘:abc:compileGroovy’.

java.lang.StackOverflowError (no error message)

When using --scan you created a build scan of which you get the link to in the end.
That is what I asked for.

Here is the scan link : Build Scan® activation | Gradle Cloud Services

The stack overflow error is not part of the scan, can you please do again including -s?

Also, you get at the same time an out of memory error, so maybe that is your actual problem.