stoicflame / enunciate

Build-time enhancement tool for Java-based Web services projects
http://enunciate.webcohesion.com/
Other
481 stars 201 forks source link

IllegalStateException "Recursive update" in ConcurrentHashMap #1216

Open mdescher opened 1 day ago

mdescher commented 1 day ago

Sometimes our builds run into an IllegalArgumentException with the message "Recursive update" thrown by ConcurrentHashMap.

Relevant part of stack trace:

Caused by: java.lang.IllegalStateException: Recursive update
    at java.util.concurrent.ConcurrentHashMap.transfer (ConcurrentHashMap.java:2552)
    at java.util.concurrent.ConcurrentHashMap.addCount (ConcurrentHashMap.java:2354)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent (ConcurrentHashMap.java:1776)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.getLombokMethodDecorations (LombokDecoration.java:52)
[...]
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.lambda$getLombokMethodDecorations$1 (LombokDecoration.java:54)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent (ConcurrentHashMap.java:1708)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.getLombokMethodDecorations (LombokDecoration.java:52)

LombokDecoration#getLombokMethodDecorations calls ConcurrentHashMap#computeIfAbsent on the CACHE ConcurrentHashMap. The passed in function later again calls ConcurrentHashMap#computeIfAbsent on the same hash map. The Javadoc of ConcurrentHashMap#computeIfAbsent states: The mapping function must not modify this map during computation.

Full stack trace:

Caused by: java.lang.IllegalStateException: Recursive update
    at java.util.concurrent.ConcurrentHashMap.transfer (ConcurrentHashMap.java:2552)
    at java.util.concurrent.ConcurrentHashMap.addCount (ConcurrentHashMap.java:2354)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent (ConcurrentHashMap.java:1776)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.getLombokMethodDecorations (LombokDecoration.java:52)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.visitType (LombokDecoration.java:40)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.visitType (LombokDecoration.java:28)
    at com.webcohesion.enunciate.javac.decorations.element.DecoratedTypeElement.accept (DecoratedTypeElement.java:230)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.applyTo (LombokDecoration.java:34)
    at com.webcohesion.enunciate.javac.decorations.element.DecoratedElement.<init> (DecoratedElement.java:53)
    at com.webcohesion.enunciate.javac.decorations.element.DecoratedTypeElement.<init> (DecoratedTypeElement.java:52)
    at com.webcohesion.enunciate.javac.decorations.ElementDecorator.visitType (ElementDecorator.java:112)
    at com.webcohesion.enunciate.javac.decorations.ElementDecorator.visitType (ElementDecorator.java:31)
    at com.sun.tools.javac.code.Symbol$ClassSymbol.accept (Symbol.java:1615)
    at com.webcohesion.enunciate.javac.decorations.ElementDecorator.decorate (ElementDecorator.java:58)
    at com.webcohesion.enunciate.javac.decorations.DecoratedElements.getTypeElement (DecoratedElements.java:58)
    at com.webcohesion.enunciate.javac.decorations.type.TypeMirrorUtils.mirrorOf (TypeMirrorUtils.java:56)
    at com.webcohesion.enunciate.javac.decorations.type.DecoratedTypeMirror.isInstanceOf (DecoratedTypeMirror.java:99)
    at com.webcohesion.enunciate.javac.decorations.type.DecoratedReferenceType.isInstanceOf (DecoratedReferenceType.java:44)
    at com.webcohesion.enunciate.javac.decorations.type.DecoratedDeclaredType.isInstanceOf (DecoratedDeclaredType.java:73)
    at com.webcohesion.enunciate.javac.decorations.element.DecoratedExecutableElement.isIs (DecoratedExecutableElement.java:142)
    at com.webcohesion.enunciate.javac.decorations.element.DecoratedExecutableElement.getPropertyName (DecoratedExecutableElement.java:152)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.shouldGenerateGetter (LombokDecoration.java:70)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.lambda$getLombokMethodDecorations$0 (LombokDecoration.java:55)
    at java.util.ArrayList.forEach (ArrayList.java:1596)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.lambda$getLombokMethodDecorations$1 (LombokDecoration.java:54)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent (ConcurrentHashMap.java:1708)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.getLombokMethodDecorations (LombokDecoration.java:52)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.visitType (LombokDecoration.java:40)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.visitType (LombokDecoration.java:28)
    at com.webcohesion.enunciate.javac.decorations.element.DecoratedTypeElement.accept (DecoratedTypeElement.java:230)
    at com.webcohesion.enunciate.modules.lombok.LombokDecoration.applyTo (LombokDecoration.java:34)
    at com.webcohesion.enunciate.javac.decorations.element.DecoratedElement.<init> (DecoratedElement.java:53)
    at com.webcohesion.enunciate.javac.decorations.element.DecoratedTypeElement.<init> (DecoratedTypeElement.java:52)
    at com.webcohesion.enunciate.javac.decorations.ElementDecorator.visitType (ElementDecorator.java:112)
    at com.webcohesion.enunciate.javac.decorations.ElementDecorator.visitType (ElementDecorator.java:31)
    at com.sun.tools.javac.code.Symbol$ClassSymbol.accept (Symbol.java:1615)
    at com.webcohesion.enunciate.javac.decorations.ElementDecorator.decorate (ElementDecorator.java:58)
    at com.webcohesion.enunciate.EnunciateAnnotationProcessor.process (EnunciateAnnotationProcessor.java:98)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor (JavacProcessingEnvironment.java:1021)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs (JavacProcessingEnvironment.java:937)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run (JavacProcessingEnvironment.java:1265)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing (JavacProcessingEnvironment.java:1380)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations (JavaCompiler.java:1272)
    at com.sun.tools.javac.main.JavaCompiler.compile (JavaCompiler.java:946)
    at com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0 (JavacTaskImpl.java:104)
    at com.sun.tools.javac.api.JavacTaskImpl.invocationHelper (JavacTaskImpl.java:152)
    at com.sun.tools.javac.api.JavacTaskImpl.doCall (JavacTaskImpl.java:100)
    at com.sun.tools.javac.api.JavacTaskImpl.call (JavacTaskImpl.java:94)
    at com.webcohesion.enunciate.Enunciate.run (Enunciate.java:656)
    at com.webcohesion.enunciate.mojo.ConfigMojo.execute (ConfigMojo.java:436)
    at com.webcohesion.enunciate.mojo.DocsBaseMojo.execute (DocsBaseMojo.java:100)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
stoicflame commented 1 day ago

Okay, thanks for the report.