xmolecules/jmolecules-integrations

`ConcurrentModificationException` in `PluginLogger` in multi module gradle project

theborakompanioni opened this issue · 2 comments

When building a multi-module Java project with gradle a ConcurrentModificationException exception is thrown sometimes.

gradle settings:

org.gradle.configureondemand=true
org.gradle.parallel=true

The issue disappears with org.gradle.parallel=false.

Logs:

 > Task :app:other:javadocJar
Failed to close org.jmolecules.bytebuddy.JMoleculesPlugin@34cbee44
> Task :app:core:build
java.util.ConcurrentModificationException
	at java.base/java.util.TreeMap.forEach(TreeMap.java:1285)
	at org.jmolecules.bytebuddy.PluginLogger.flush(PluginLogger.java:70)
	at org.jmolecules.bytebuddy.LoggingPlugin.close(LoggingPlugin.java:35)
	at net.bytebuddy.build.Plugin$Engine$Default.apply(Plugin.java:4725)
	at net.bytebuddy.build.gradle.AbstractByteBuddyTask.doApply(AbstractByteBuddyTask.java:460)
	at net.bytebuddy.build.gradle.ByteBuddyTask.apply(ByteBuddyTask.java:175)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:577)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)

See org.jmolecules.bytebuddy.PluginLogger.flush(PluginLogger.java:70)

Runtime:

jmoleculesBomVersion = '2023.1.1'
java --version
openjdk 18.0.2.1 2022-08-18
OpenJDK Runtime Environment Temurin-18.0.2.1+1 (build 18.0.2.1+1)
OpenJDK 64-Bit Server VM Temurin-18.0.2.1+1 (build 18.0.2.1+1, mixed mode, sharing)
./gradlew --version
------------------------------------------------------------
Gradle 8.4
------------------------------------------------------------
Build time:   2023-10-04 20:52:13 UTC
Revision:     e9251e572c9bd1d01e503a0dfdf43aedaeecdc3f

This should be fixed in the latest snapshots. Would you mind giving them a spin?

This should be fixed in the latest snapshots. Would you mind giving them a spin?

Seems to work great as far as I can tell! 💪
Thank you very much 🙏