Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel build without forking in a multi-module leads to spotbugs getting stuck #488

Closed
blacelle opened this issue Sep 14, 2022 · 17 comments
Assignees

Comments

@blacelle
Copy link

blacelle commented Sep 14, 2022

I consider a 50+ multi-module project, with 100k+ java files. When applying spotbugs in our projects, we spend roughly 1 second per project. OK

I'm on the latest versions:

	<spotbugs.version>4.7.2</spotbugs.version>
	<spotbugs-maven.version>${spotbugs.version}.0</spotbugs-maven.version>

If I run the process with parallelism (e.g. mvn install -T 8), our build tends to timeout. I attach a jstack.
bug_spotbugs.txt

The main elements are :

  • We see 3 modules, each processing in their own thread.
  • We see 3 pending modules, having each an ExecuteJava forked task
  • We see 2 of these tasks waiting on a lock for the third one
  • The 3rd ExecuteJava is reading some FileInputStream, but I do not get why it is not progressing:
   java.lang.Thread.State: RUNNABLE
	at java.io.FileInputStream.readBytes(java.base@17.0.2/Native Method)
	at java.io.FileInputStream.read(java.base@17.0.2/FileInputStream.java:276)
	at java.io.BufferedInputStream.read1(java.base@17.0.2/BufferedInputStream.java:282)
	at java.io.BufferedInputStream.read(java.base@17.0.2/BufferedInputStream.java:343)
	- locked <0x0000000400006e58> (a java.io.BufferedInputStream)
	at org.apache.tools.ant.Project.defaultInput(Project.java:1306)
	at org.apache.tools.ant.Project.demuxInput(Project.java:1325)
	at org.apache.tools.ant.DemuxInputStream.read(DemuxInputStream.java:73)
	at sun.nio.cs.StreamDecoder.readBytes(java.base@17.0.2/StreamDecoder.java:270)
	at sun.nio.cs.StreamDecoder.implRead(java.base@17.0.2/StreamDecoder.java:313)
	at sun.nio.cs.StreamDecoder.read(java.base@17.0.2/StreamDecoder.java:188)
	- locked <0x000000042f2db7d0> (a java.io.InputStreamReader)
	at java.io.InputStreamReader.read(java.base@17.0.2/InputStreamReader.java:177)
	at java.io.BufferedReader.fill(java.base@17.0.2/BufferedReader.java:162)
	at java.io.BufferedReader.readLine(java.base@17.0.2/BufferedReader.java:329)
	- locked <0x000000042f2db7d0> (a java.io.InputStreamReader)
	at java.io.BufferedReader.readLine(java.base@17.0.2/BufferedReader.java:396)
	at edu.umd.cs.findbugs.TextUICommandLine.handleOption(TextUICommandLine.java:411)

The issue seems to occur very frequently (if not always) in our case (as long as the parallelism is high enough).


The main elements of the threaddump:

2022-09-14 17:08:16
Full thread dump OpenJDK 64-Bit Server VM (17.0.2+8 mixed mode, sharing):

Threads class SMR info:
_java_thread_list=0x0000600000a18000, length=46, elements={
0x00007feeb8008a00, 0x00007fee8e808200, 0x00007fee8e80aa00, 0x00007feeb8037c00,
0x00007fee8f008200, 0x00007fee8f008800, 0x00007fee8f00c000, 0x00007fee8e809600,
0x00007feeaf80c000, 0x00007feeb803a200, 0x00007fee8f04ee00, 0x00007fee3f039600,
0x00007feeaf842000, 0x00007fee8f271000, 0x00007feeb83f4800, 0x00007fedef3b0400,
0x00007fedeeb41000, 0x00007fedefa92800, 0x00007feeaece2a00, 0x00007fee3f0c4800,
0x00007feeaf8a2e00, 0x00007feeaf8b2600, 0x00007fee8f8cea00, 0x00007feeafb10200,
0x00007fee9eab8200, 0x00007fee3e9f2600, 0x00007fee8e808e00, 0x00007fee8ea97a00,
0x00007fedfc008200, 0x00007fedf87f8e00, 0x00007fee2e931c00, 0x00007fedfc011a00,
0x00007fedefc99400, 0x00007fedefc72600, 0x00007fee3e848c00, 0x00007fedfacd0e00,
0x00007fedfade1400, 0x00007fedfacd2a00, 0x00007fedfb80b000, 0x00007fedfba82000,
0x00007fedfba80e00, 0x00007fedfe763800, 0x00007fee8f6c9800, 0x00007fee29251600,
0x00007feeb85fca00, 0x00007fee3f391c00
}


"main" #1 prio=5 os_prio=31 cpu=1671.27ms elapsed=462.55s tid=0x00007feeb8008a00 nid=0x1c03 waiting on condition  [0x000070000184c000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@17.0.2/Native Method)
	- parking to wait for  <0x0000000402d30870> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(java.base@17.0.2/LockSupport.java:341)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(java.base@17.0.2/AbstractQueuedSynchronizer.java:506)
	at java.util.concurrent.ForkJoinPool.unmanagedBlock(java.base@17.0.2/ForkJoinPool.java:3463)
	at java.util.concurrent.ForkJoinPool.managedBlock(java.base@17.0.2/ForkJoinPool.java:3434)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@17.0.2/AbstractQueuedSynchronizer.java:1623)
	at java.util.concurrent.LinkedBlockingQueue.take(java.base@17.0.2/LinkedBlockingQueue.java:435)
	at java.util.concurrent.ExecutorCompletionService.take(java.base@17.0.2/ExecutorCompletionService.java:200)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder.multiThreadedProjectTaskSegmentBuild(MultiThreadedBuilder.java:145)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder.build(MultiThreadedBuilder.java:103)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:972)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@17.0.2/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@17.0.2/NativeMethodAccessorImpl.java:77)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@17.0.2/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base@17.0.2/Method.java:568)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)

"mvn-builder-XXX:sms:jar:68.0-SNAPSHOT" #24 prio=5 os_prio=31 cpu=5536.89ms elapsed=460.03s tid=0x00007fee3f039600 nid=0xb303 in Object.wait()  [0x0000700004ce9000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@17.0.2/Native Method)
	- waiting on <0x00000004571f6000> (a org.apache.tools.ant.taskdefs.ExecuteJava)
	at java.lang.Object.wait(java.base@17.0.2/Object.java:338)
	at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:174)
	- locked <0x00000004571f6000> (a org.apache.tools.ant.taskdefs.ExecuteJava)
	at org.apache.tools.ant.taskdefs.Java.run(Java.java:891)
	at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:231)
	at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
	at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@17.0.2/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@17.0.2/NativeMethodAccessorImpl.java:77)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@17.0.2/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base@17.0.2/Method.java:568)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
	at groovy.ant.AntBuilder.performTask(AntBuilder.java:347)
	at groovy.ant.AntBuilder.nodeCompleted(AntBuilder.java:286)
	at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:161)
	at groovy.ant.AntBuilder.doInvokeMethod(AntBuilder.java:219)
	at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:75)
	at org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.invokeGroovyObjectInvoker(IndyGuardsFiltersAndSignatures.java:149)
	at java.lang.invoke.DirectMethodHandle$Holder.invokeStatic(java.base@17.0.2/DirectMethodHandle$Holder)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a59400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1d400.guardWithCatch(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1dc00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1e000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1dc00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1e000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1dc00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a5a000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801572400.invokeExact_MT(java.base@17.0.2/LambdaForm$MH)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
	at java.lang.invoke.LambdaForm$DMH/0x000000080155e000.invokeStatic(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1c400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.Invokers$Holder.linkToCallSite(java.base@17.0.2/Invokers$Holder)
	at org.codehaus.mojo.spotbugs.SpotBugsMojo.executeSpotbugs(SpotBugsMojo.groovy:1167)
	at java.lang.invoke.LambdaForm$DMH/0x0000000800ef0000.invokeSpecial(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801586400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x000000080156f000.guardWithCatch(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570800.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570c00.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570800.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570c00.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570800.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1a000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801572400.invokeExact_MT(java.base@17.0.2/LambdaForm$MH)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
	at java.lang.invoke.LambdaForm$DMH/0x000000080155e000.invokeStatic(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801564000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.Invokers$Holder.linkToCallSite(java.base@17.0.2/Invokers$Holder)
	at org.codehaus.mojo.spotbugs.SpotBugsMojo.canGenerateReport(SpotBugsMojo.groovy:656)
	at java.lang.invoke.LambdaForm$DMH/0x0000000800f9c000.invokeInterface(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801587400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584800.guardWithCatch(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584c00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801585000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584c00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801585000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584c00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801586000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801572400.invokeExact_MT(java.base@17.0.2/LambdaForm$MH)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
	at java.lang.invoke.LambdaForm$DMH/0x000000080155e000.invokeStatic(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.Invokers$Holder.linkToCallSite(java.base@17.0.2/Invokers$Holder)
	at org.codehaus.mojo.spotbugs.SpotBugsMojo.execute(SpotBugsMojo.groovy:782)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:355)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:196)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:186)
	at java.util.concurrent.FutureTask.run(java.base@17.0.2/FutureTask.java:264)
	at java.util.concurrent.Executors$RunnableAdapter.call(java.base@17.0.2/Executors.java:539)
	at java.util.concurrent.FutureTask.run(java.base@17.0.2/FutureTask.java:264)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17.0.2/ThreadPoolExecutor.java:1136)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17.0.2/ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(java.base@17.0.2/Thread.java:833)

"mvn-builder-XXX:dp-constants:jar:68.0-SNAPSHOT" #130 prio=5 os_prio=31 cpu=5835.36ms elapsed=188.07s tid=0x00007fedfacd0e00 nid=0x9c43 in Object.wait()  [0x0000700002e8f000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@17.0.2/Native Method)
	- waiting on <0x0000000456c2fbe8> (a org.apache.tools.ant.taskdefs.ExecuteJava)
	at java.lang.Object.wait(java.base@17.0.2/Object.java:338)
	at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:174)
	- locked <0x0000000456c2fbe8> (a org.apache.tools.ant.taskdefs.ExecuteJava)
	at org.apache.tools.ant.taskdefs.Java.run(Java.java:891)
	at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:231)
	at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
	at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@17.0.2/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@17.0.2/NativeMethodAccessorImpl.java:77)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@17.0.2/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base@17.0.2/Method.java:568)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
	at groovy.ant.AntBuilder.performTask(AntBuilder.java:347)
	at groovy.ant.AntBuilder.nodeCompleted(AntBuilder.java:286)
	at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:161)
	at groovy.ant.AntBuilder.doInvokeMethod(AntBuilder.java:219)
	at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:75)
	at org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.invokeGroovyObjectInvoker(IndyGuardsFiltersAndSignatures.java:149)
	at java.lang.invoke.DirectMethodHandle$Holder.invokeStatic(java.base@17.0.2/DirectMethodHandle$Holder)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a59400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1d400.guardWithCatch(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1dc00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1e000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1dc00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1e000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1dc00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a5a000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801572400.invokeExact_MT(java.base@17.0.2/LambdaForm$MH)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
	at java.lang.invoke.LambdaForm$DMH/0x000000080155e000.invokeStatic(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1c400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.Invokers$Holder.linkToCallSite(java.base@17.0.2/Invokers$Holder)
	at org.codehaus.mojo.spotbugs.SpotBugsMojo.executeSpotbugs(SpotBugsMojo.groovy:1167)
	at java.lang.invoke.LambdaForm$DMH/0x0000000800ef0000.invokeSpecial(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801586400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x000000080156f000.guardWithCatch(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570800.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570c00.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570800.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570c00.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570800.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1a000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801572400.invokeExact_MT(java.base@17.0.2/LambdaForm$MH)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
	at java.lang.invoke.LambdaForm$DMH/0x000000080155e000.invokeStatic(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801564000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.Invokers$Holder.linkToCallSite(java.base@17.0.2/Invokers$Holder)
	at org.codehaus.mojo.spotbugs.SpotBugsMojo.canGenerateReport(SpotBugsMojo.groovy:656)
	at java.lang.invoke.LambdaForm$DMH/0x0000000800f9c000.invokeInterface(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801587400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584800.guardWithCatch(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584c00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801585000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584c00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801585000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584c00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801586000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801572400.invokeExact_MT(java.base@17.0.2/LambdaForm$MH)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
	at java.lang.invoke.LambdaForm$DMH/0x000000080155e000.invokeStatic(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.Invokers$Holder.linkToCallSite(java.base@17.0.2/Invokers$Holder)
	at org.codehaus.mojo.spotbugs.SpotBugsMojo.execute(SpotBugsMojo.groovy:782)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:355)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:196)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:186)
	at java.util.concurrent.FutureTask.run(java.base@17.0.2/FutureTask.java:264)
	at java.util.concurrent.Executors$RunnableAdapter.call(java.base@17.0.2/Executors.java:539)
	at java.util.concurrent.FutureTask.run(java.base@17.0.2/FutureTask.java:264)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17.0.2/ThreadPoolExecutor.java:1136)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17.0.2/ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(java.base@17.0.2/Thread.java:833)

"mvn-builder-XXX:captcha-breaker:jar:68.0-SNAPSHOT" #133 prio=5 os_prio=31 cpu=4138.04ms elapsed=188.07s tid=0x00007fedfb80b000 nid=0x13e0f in Object.wait()  [0x00007000051f8000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@17.0.2/Native Method)
	- waiting on <0x000000040aa90dc8> (a org.apache.tools.ant.taskdefs.ExecuteJava)
	at java.lang.Object.wait(java.base@17.0.2/Object.java:338)
	at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:174)
	- locked <0x000000040aa90dc8> (a org.apache.tools.ant.taskdefs.ExecuteJava)
	at org.apache.tools.ant.taskdefs.Java.run(Java.java:891)
	at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:231)
	at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
	at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@17.0.2/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@17.0.2/NativeMethodAccessorImpl.java:77)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@17.0.2/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base@17.0.2/Method.java:568)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
	at groovy.ant.AntBuilder.performTask(AntBuilder.java:347)
	at groovy.ant.AntBuilder.nodeCompleted(AntBuilder.java:286)
	at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:161)
	at groovy.ant.AntBuilder.doInvokeMethod(AntBuilder.java:219)
	at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:75)
	at org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.invokeGroovyObjectInvoker(IndyGuardsFiltersAndSignatures.java:149)
	at java.lang.invoke.DirectMethodHandle$Holder.invokeStatic(java.base@17.0.2/DirectMethodHandle$Holder)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a59400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1d400.guardWithCatch(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1dc00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1e000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1dc00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1e000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1dc00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a5a000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801572400.invokeExact_MT(java.base@17.0.2/LambdaForm$MH)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
	at java.lang.invoke.LambdaForm$DMH/0x000000080155e000.invokeStatic(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1c400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.Invokers$Holder.linkToCallSite(java.base@17.0.2/Invokers$Holder)
	at org.codehaus.mojo.spotbugs.SpotBugsMojo.executeSpotbugs(SpotBugsMojo.groovy:1167)
	at java.lang.invoke.LambdaForm$DMH/0x0000000800ef0000.invokeSpecial(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801586400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x000000080156f000.guardWithCatch(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570800.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570c00.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570800.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570c00.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801570800.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801a1a000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801572400.invokeExact_MT(java.base@17.0.2/LambdaForm$MH)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
	at java.lang.invoke.LambdaForm$DMH/0x000000080155e000.invokeStatic(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801564000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.Invokers$Holder.linkToCallSite(java.base@17.0.2/Invokers$Holder)
	at org.codehaus.mojo.spotbugs.SpotBugsMojo.canGenerateReport(SpotBugsMojo.groovy:656)
	at java.lang.invoke.LambdaForm$DMH/0x0000000800f9c000.invokeInterface(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801587400.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584800.guardWithCatch(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584c00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801585000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584c00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801585000.guard(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584c00.reinvoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801586000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801572400.invokeExact_MT(java.base@17.0.2/LambdaForm$MH)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
	at java.lang.invoke.LambdaForm$DMH/0x000000080155e000.invokeStatic(java.base@17.0.2/LambdaForm$DMH)
	at java.lang.invoke.LambdaForm$MH/0x0000000801584000.invoke(java.base@17.0.2/LambdaForm$MH)
	at java.lang.invoke.Invokers$Holder.linkToCallSite(java.base@17.0.2/Invokers$Holder)
	at org.codehaus.mojo.spotbugs.SpotBugsMojo.execute(SpotBugsMojo.groovy:782)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:355)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:196)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:186)
	at java.util.concurrent.FutureTask.run(java.base@17.0.2/FutureTask.java:264)
	at java.util.concurrent.Executors$RunnableAdapter.call(java.base@17.0.2/Executors.java:539)
	at java.util.concurrent.FutureTask.run(java.base@17.0.2/FutureTask.java:264)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17.0.2/ThreadPoolExecutor.java:1136)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17.0.2/ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(java.base@17.0.2/Thread.java:833)

"ExecuteJava" #304 daemon prio=5 os_prio=31 cpu=41.50ms elapsed=150.48s tid=0x00007fedfba80e00 nid=0x1650b runnable  [0x0000700006127000]
   java.lang.Thread.State: RUNNABLE
	at java.io.FileInputStream.readBytes(java.base@17.0.2/Native Method)
	at java.io.FileInputStream.read(java.base@17.0.2/FileInputStream.java:276)
	at java.io.BufferedInputStream.read1(java.base@17.0.2/BufferedInputStream.java:282)
	at java.io.BufferedInputStream.read(java.base@17.0.2/BufferedInputStream.java:343)
	- locked <0x0000000400006e58> (a java.io.BufferedInputStream)
	at org.apache.tools.ant.Project.defaultInput(Project.java:1306)
	at org.apache.tools.ant.Project.demuxInput(Project.java:1325)
	at org.apache.tools.ant.DemuxInputStream.read(DemuxInputStream.java:73)
	at sun.nio.cs.StreamDecoder.readBytes(java.base@17.0.2/StreamDecoder.java:270)
	at sun.nio.cs.StreamDecoder.implRead(java.base@17.0.2/StreamDecoder.java:313)
	at sun.nio.cs.StreamDecoder.read(java.base@17.0.2/StreamDecoder.java:188)
	- locked <0x000000042f2db7d0> (a java.io.InputStreamReader)
	at java.io.InputStreamReader.read(java.base@17.0.2/InputStreamReader.java:177)
	at java.io.BufferedReader.fill(java.base@17.0.2/BufferedReader.java:162)
	at java.io.BufferedReader.readLine(java.base@17.0.2/BufferedReader.java:329)
	- locked <0x000000042f2db7d0> (a java.io.InputStreamReader)
	at java.io.BufferedReader.readLine(java.base@17.0.2/BufferedReader.java:396)
	at edu.umd.cs.findbugs.TextUICommandLine.handleOption(TextUICommandLine.java:411)
	at edu.umd.cs.findbugs.config.CommandLine.parse(CommandLine.java:338)
	at edu.umd.cs.findbugs.config.CommandLine.parse(CommandLine.java:300)
	at edu.umd.cs.findbugs.FindBugs.processCommandLine(FindBugs.java:345)
	at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1221)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@17.0.2/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@17.0.2/NativeMethodAccessorImpl.java:77)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@17.0.2/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base@17.0.2/Method.java:568)
	at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:218)
	at java.lang.Thread.run(java.base@17.0.2/Thread.java:833)

"ExecuteJava" #377 daemon prio=5 os_prio=31 cpu=35.49ms elapsed=146.43s tid=0x00007fee8f6c9800 nid=0x1292b waiting for monitor entry  [0x000070000632d000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.BufferedInputStream.read(java.base@17.0.2/BufferedInputStream.java:334)
	- waiting to lock <0x0000000400006e58> (a java.io.BufferedInputStream)
	at org.apache.tools.ant.Project.defaultInput(Project.java:1306)
	at org.apache.tools.ant.Project.demuxInput(Project.java:1325)
	at org.apache.tools.ant.DemuxInputStream.read(DemuxInputStream.java:73)
	at sun.nio.cs.StreamDecoder.readBytes(java.base@17.0.2/StreamDecoder.java:270)
	at sun.nio.cs.StreamDecoder.implRead(java.base@17.0.2/StreamDecoder.java:313)
	at sun.nio.cs.StreamDecoder.read(java.base@17.0.2/StreamDecoder.java:188)
	- locked <0x00000004470e4a88> (a java.io.InputStreamReader)
	at java.io.InputStreamReader.read(java.base@17.0.2/InputStreamReader.java:177)
	at java.io.BufferedReader.fill(java.base@17.0.2/BufferedReader.java:162)
	at java.io.BufferedReader.readLine(java.base@17.0.2/BufferedReader.java:329)
	- locked <0x00000004470e4a88> (a java.io.InputStreamReader)
	at java.io.BufferedReader.readLine(java.base@17.0.2/BufferedReader.java:396)
	at edu.umd.cs.findbugs.TextUICommandLine.handleOption(TextUICommandLine.java:411)
	at edu.umd.cs.findbugs.config.CommandLine.parse(CommandLine.java:338)
	at edu.umd.cs.findbugs.config.CommandLine.parse(CommandLine.java:300)
	at edu.umd.cs.findbugs.FindBugs.processCommandLine(FindBugs.java:345)
	at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1221)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@17.0.2/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@17.0.2/NativeMethodAccessorImpl.java:77)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@17.0.2/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base@17.0.2/Method.java:568)
	at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:218)
	at java.lang.Thread.run(java.base@17.0.2/Thread.java:833)

"ExecuteJava" #379 daemon prio=5 os_prio=31 cpu=37.55ms elapsed=146.39s tid=0x00007feeb85fca00 nid=0xc72f waiting for monitor entry  [0x0000700006533000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.io.BufferedInputStream.read(java.base@17.0.2/BufferedInputStream.java:334)
	- waiting to lock <0x0000000400006e58> (a java.io.BufferedInputStream)
	at org.apache.tools.ant.Project.defaultInput(Project.java:1306)
	at org.apache.tools.ant.Project.demuxInput(Project.java:1325)
	at org.apache.tools.ant.DemuxInputStream.read(DemuxInputStream.java:73)
	at sun.nio.cs.StreamDecoder.readBytes(java.base@17.0.2/StreamDecoder.java:270)
	at sun.nio.cs.StreamDecoder.implRead(java.base@17.0.2/StreamDecoder.java:313)
	at sun.nio.cs.StreamDecoder.read(java.base@17.0.2/StreamDecoder.java:188)
	- locked <0x000000044767c208> (a java.io.InputStreamReader)
	at java.io.InputStreamReader.read(java.base@17.0.2/InputStreamReader.java:177)
	at java.io.BufferedReader.fill(java.base@17.0.2/BufferedReader.java:162)
	at java.io.BufferedReader.readLine(java.base@17.0.2/BufferedReader.java:329)
	- locked <0x000000044767c208> (a java.io.InputStreamReader)
	at java.io.BufferedReader.readLine(java.base@17.0.2/BufferedReader.java:396)
	at edu.umd.cs.findbugs.TextUICommandLine.handleOption(TextUICommandLine.java:411)
	at edu.umd.cs.findbugs.config.CommandLine.parse(CommandLine.java:338)
	at edu.umd.cs.findbugs.config.CommandLine.parse(CommandLine.java:300)
	at edu.umd.cs.findbugs.FindBugs.processCommandLine(FindBugs.java:345)
	at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1221)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@17.0.2/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@17.0.2/NativeMethodAccessorImpl.java:77)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@17.0.2/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base@17.0.2/Method.java:568)
	at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:218)
	at java.lang.Thread.run(java.base@17.0.2/Thread.java:833)

@hazendaz
Copy link
Member

@blacelle This is a strange one, we run our integration tests on github actions in parallel and those all work. I presume you cannot share what you are running more than you have here. If that is the case, can you see if it is feasible to produce a small sample that has this issue or possibly look in our readme at how we run integration tests and give any pointers into what we are doing that may differ that we might try to cause same issue?

@blacelle
Copy link
Author

I presume you cannot share what you are running more than you have here.

Indeed, this happens with a private project. I'm not able to reproduce with public projects with similar configuration.

I see in https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/Project.java#L1300 that given piece of code may rely on System.in, which may explains something getting stuck.

Given the 3 ExecuteJava seems to be relying on the same underlying BufferedInputStream, I would guess there are conflicting with each others, as I would not expect these 3 modules to interact in such a way. Maybe one module consumed part of the input, and the other module in waiting indefinitely for some input consumed by the other thread.

I suppose this is not reproduced in spotbugs own integration tests due to some race-condition

@blacelle
Copy link
Author

@corebonts
Copy link

We have the same issue, with the same stack traces, so one is waiting for the System.in, and the others are waiting for that first one.

Could the auxclasspath passed in the arguments file or in a separate file instead of the System.in?

$ java --version
openjdk 17.0.3 2022-04-19
OpenJDK Runtime Environment JBR-17.0.3+7-463.3-nomod (build 17.0.3+7-b463.3)
OpenJDK 64-Bit Server VM JBR-17.0.3+7-463.3-nomod (build 17.0.3+7-b463.3, mixed mode)
$ mvn --version
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/maven
Java version: 17.0.3, vendor: JetBrains s.r.o., runtime: /home/gabor/bin/jbrsdk
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.10.102.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"

Blocking thread:

stackTrace:
java.lang.Thread.State: RUNNABLE
at java.io.FileInputStream.readBytes(java.base@17.0.3/Native Method)
at java.io.FileInputStream.read(java.base@17.0.3/FileInputStream.java:276)
at java.io.BufferedInputStream.read1(java.base@17.0.3/BufferedInputStream.java:282)
at java.io.BufferedInputStream.read(java.base@17.0.3/BufferedInputStream.java:343)
- locked <0x00000007000e5b60> (a java.io.BufferedInputStream)
at org.apache.tools.ant.Project.defaultInput(Project.java:1306)
at org.apache.tools.ant.Project.demuxInput(Project.java:1325)
at org.apache.tools.ant.DemuxInputStream.read(DemuxInputStream.java:73)
at sun.nio.cs.StreamDecoder.readBytes(java.base@17.0.3/StreamDecoder.java:270)
at sun.nio.cs.StreamDecoder.implRead(java.base@17.0.3/StreamDecoder.java:313)
at sun.nio.cs.StreamDecoder.read(java.base@17.0.3/StreamDecoder.java:188)
- locked <0x00000007010fb548> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(java.base@17.0.3/InputStreamReader.java:177)
at java.io.BufferedReader.fill(java.base@17.0.3/BufferedReader.java:162)
at java.io.BufferedReader.readLine(java.base@17.0.3/BufferedReader.java:329)
- locked <0x00000007010fb548> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(java.base@17.0.3/BufferedReader.java:396)
at edu.umd.cs.findbugs.TextUICommandLine.handleOption(TextUICommandLine.java:411)
at edu.umd.cs.findbugs.config.CommandLine.parse(CommandLine.java:338)
at edu.umd.cs.findbugs.config.CommandLine.parse(CommandLine.java:300)
at edu.umd.cs.findbugs.FindBugs.processCommandLine(FindBugs.java:345)
at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1221)

4 blocked threads:

java.lang.Thread.State: BLOCKED (on object monitor)
at java.io.BufferedInputStream.read(java.base@17.0.3/BufferedInputStream.java:334)
- waiting to lock <0x00000007000e5b60> (a java.io.BufferedInputStream)
at org.apache.tools.ant.Project.defaultInput(Project.java:1306)
at org.apache.tools.ant.Project.demuxInput(Project.java:1325)
at org.apache.tools.ant.DemuxInputStream.read(DemuxInputStream.java:73)
at sun.nio.cs.StreamDecoder.readBytes(java.base@17.0.3/StreamDecoder.java:270)
at sun.nio.cs.StreamDecoder.implRead(java.base@17.0.3/StreamDecoder.java:313)
at sun.nio.cs.StreamDecoder.read(java.base@17.0.3/StreamDecoder.java:188)
- locked <0x00000007010282b8> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(java.base@17.0.3/InputStreamReader.java:177)
at java.io.BufferedReader.fill(java.base@17.0.3/BufferedReader.java:162)
at java.io.BufferedReader.readLine(java.base@17.0.3/BufferedReader.java:329)
- locked <0x00000007010282b8> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(java.base@17.0.3/BufferedReader.java:396)
at edu.umd.cs.findbugs.TextUICommandLine.handleOption(TextUICommandLine.java:411)
at edu.umd.cs.findbugs.config.CommandLine.parse(CommandLine.java:338)
at edu.umd.cs.findbugs.config.CommandLine.parse(CommandLine.java:300)
at edu.umd.cs.findbugs.FindBugs.processCommandLine(FindBugs.java:345)
at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1221)

@blacelle
Copy link
Author

@hazendaz
Copy link
Member

hazendaz commented Jan 21, 2023 via email

@blacelle
Copy link
Author

blacelle commented Jan 22, 2023

I open a PR ins spotbugs to synchronize the System.in reads. We would need to synchronize the write also (else multiple writes would interleave in System.in). Alternativaly, we could add some shorter timeout in the read. It would not prevent issues, but it would prevent being stuck for 10 minutes.

@hazendaz
Copy link
Member

Not sure I follow how we are using UI during normal spotbugs run, that logic would indicate asking for input but that run isn't going to do that. feels like the GUI is being used during that type of run, can you confirm that? Having a hard time understanding it otherwise. The change on spotbugs is ok but it really shouldn't call out its due to maven plugin because gradle could do the same.

@hazendaz
Copy link
Member

@blacelle Unlikely I'll add this is not thread safe here as I don't plan to release until next spotbugs at the current moment. Can you show me full setup you are using though as I'm still perplexed at why system.in is used during normal spotbugs execution. That is for the GUI based on naming alone and system in expects to provide some system input. I'm confused how that would be getting executed. I haven't looked very deep though but just confused on how maven plugin run would ever be wanting system input like that. Possibly we are missing some features here, not sure or maybe your run was GUI based to launch that and that causes the issue.

@blacelle
Copy link
Author

blacelle commented Jan 26, 2023

feels like the GUI is being used during that type of run, can you confirm that?

No.

The change on spotbugs is ok but it really shouldn't call out its due to maven plugin because gradle could do the same.

I may dig into spotbugs-gradle if it was necessary.

Here is a typical configuration producing this issue:

https://github.com/solven-eu/cleanthat/blob/master/pom.xml#L517-L547

				<plugin>
					<!--https://spotbugs.github.io/spotbugs-maven-plugin/index.html -->
					<groupId>com.github.spotbugs</groupId>
					<artifactId>spotbugs-maven-plugin</artifactId>
					<version>${spotbugs.version}</version>
					<configuration>
						<excludeFilterFile>style/pepper.spotbugs.xml</excludeFilterFile>
					</configuration>
					<dependencies>
						<dependency>
							<!-- This dependency holds the default configuration -->
							<groupId>io.github.solven-eu.pepper</groupId>
							<artifactId>pepper-static</artifactId>
							<version>${pepper.version}</version>
							<scope>runtime</scope>
						</dependency>
					</dependencies>
					<executions>
						<execution>
							<id>check</id>
							<goals>
								<goal>check</goal>
							</goals>
							<!-- default phase is verify, which is after tests. -->
							<!-- We prefer to run static analysis before tests not to wait -->
							<phase>${staticChecks}</phase>
						</execution>
					</executions>
				</plugin>

and I get the issue with cmd like 'mvn install -T 8'

@blacelle
Copy link
Author

Here is the mvn code triggering the ant task triggering FindBugs2 (as visible in the stack):

https://github.com/spotbugs/spotbugs-maven-plugin/blob/spotbugs/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy#L1184

ant.java(classname: "edu.umd.cs.findbugs.FindBugs2", inputstring: getSpotbugsAuxClasspath(), fork: "${fork}", failonerror: "true", clonevm: "false", timeout: "${timeout}", maxmemory: "${maxHeap}m") {

@blacelle
Copy link
Author

Maybe the issue is the empty -auxclasspathFromInput in

https://github.com/spotbugs/spotbugs-maven-plugin/blob/spotbugs/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy#L938

    if(!sarifOutput) {
        args << "-xml:withMessages=" + tempFile.getAbsolutePath()
    }
    else {
        args << "-sarif=" + tempFile.getAbsolutePath()
    }

    args << "-auxclasspathFromInput"

    args << "-projectName"
    args << "${project.name}"

@blacelle
Copy link
Author

I'm opening a PR to suggest removing this row. While opening the project in Eclipse, I get a stackoverflow:

java.lang.StackOverflowError
	at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:406)
	at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:145)
	at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:432)
	at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:145)
	at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:432)
	at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:145)
	at 
...
eclipse.buildId=4.25.0.I20220831-1800
java.version=17.0.4.1
java.vendor=Eclipse Adoptium
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_FR
Framework arguments:  -product org.eclipse.epp.package.java.product -keyring /Users/blacelle/.eclipse_keyring
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.java.product -keyring /Users/blacelle/.eclipse_keyring

I also see:

Project build error: Resolving expression: '${java.test.release.version}': Detected the following recursive expression cycle in 'java.test.release.version': [java.test.release.version, java.release.version]	pom.xml	/spotbugs-maven-plugin	line 1	Maven pom Loading Problem
Project build error: Resolving expression: '${java.release.version}': Detected the following recursive expression cycle in 'java.release.version': [java.release.version, java.test.release.version]	pom.xml	/spotbugs-maven-plugin	line 1	Maven pom Loading Problem

@hazendaz
Copy link
Member

hazendaz commented Jan 27, 2023 via email

@hazendaz
Copy link
Member

Fixed via #535. Will release as soon as I can figure out why I cannot upgrade groovy to 4.0.8/4.0.9 that I need...

@hazendaz hazendaz self-assigned this Feb 21, 2023
corebonts pushed a commit to corebonts/spotbugs-maven-plugin that referenced this issue Feb 24, 2023
…File argument

The plugin versions before 4.7.3.1 passed the auxiliary classpath via the
standard input, which caused a deadlock during parallel builds with
non-forked spotbugs. spotbugs#488

Although this was fixed by removing the -auxclasspathFromInput, this broke the
classpath logic.

The solution is to pass the classpath using a file.
@blacelle
Copy link
Author

blacelle commented Feb 25, 2023

This fix is available in spotbugs-maven-plugin 4.7.3.1
Thanks


#488 (comment)

Interesting to see that as a User (i.e. just having a ref to Spotbugs in some project, not opening Spotbugs source in Eclipse), I now also get issues around:

Project build error: Resolving expression: '${java.test.release.version}': Detected the following recursive expression cycle in 'java.test.release.version': [java.test.release.version, java.release.version]	pom.xml	/spotbugs-maven-plugin	line 1	Maven pom Loading Problem
Project build error: Resolving expression: '${java.release.version}': Detected the following recursive expression cycle in 'java.release.version': [java.release.version, java.test.release.version]	pom.xml	/spotbugs-maven-plugin	line 1	Maven pom Loading Problem

m2e is up to date:
M2E - Maven Integration for Eclipse 2.1.2.20221130-2239 org.eclipse.m2e.feature.feature.group Eclipse.org - m2e


org.apache.maven.plugin.PluginResolutionException: Plugin com.github.spotbugs:spotbugs-maven-plugin:4.7.3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for com.github.spotbugs:spotbugs-maven-plugin:jar:4.7.3.1
	at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:133)
	at org.eclipse.m2e.core.internal.project.registry.EclipsePluginDependenciesResolver.resolve(EclipsePluginDependenciesResolver.java:47)
	at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:182)
	at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:286)
	at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:244)
	at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:169)
	at org.eclipse.m2e.core.internal.project.registry.MavenProjectFacade.lambda$5(MavenProjectFacade.java:538)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:364)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:274)
	at org.eclipse.m2e.core.internal.project.registry.MavenProjectFacade.setupMojoExecution(MavenProjectFacade.java:534)
	at org.eclipse.m2e.core.internal.project.registry.MavenProjectFacade.getMojoExecution(MavenProjectFacade.java:516)
	at org.eclipse.m2e.core.project.configurator.AbstractCustomizableLifecycleMapping.getBuildParticipants(AbstractCustomizableLifecycleMapping.java:69)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$1(MavenBuilder.java:110)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:364)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:227)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:103)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:364)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:274)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:213)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:196)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1020)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:247)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:392)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:395)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:506)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:454)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:536)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:161)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:255)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.github.spotbugs:spotbugs-maven-plugin:jar:4.7.3.1
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:311)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:171)
	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:255)
	at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:107)
	... 33 more
Caused by: org.apache.maven.model.building.ModelBuildingException: 9 problems were encountered while building the effective model for com.github.spotbugs:spotbugs-maven-plugin:4.7.3.1
[ERROR] Resolving expression: '${java.test.release.version}': Detected the following recursive expression cycle in 'java.test.release.version': [java.test.release.version, java.release.version] @ 
[ERROR] Resolving expression: '${java.release.version}': Detected the following recursive expression cycle in 'java.release.version': [java.release.version, java.test.release.version] @ 
[ERROR] Resolving expression: '${java.test.release.version}': Detected the following recursive expression cycle in 'java.test.release.version': [java.test.release.version, java.release.version] @ 
[ERROR] Resolving expression: '${java.release.version}': Detected the following recursive expression cycle in 'java.release.version': [java.release.version, java.test.release.version] @ 
[ERROR] Resolving expression: '${java.release.version}': Detected the following recursive expression cycle in 'java.release.version': [java.release.version, java.test.release.version] @ 
[ERROR] Resolving expression: '${java.release.version}': Detected the following recursive expression cycle in 'java.release.version': [java.release.version, java.test.release.version] @ 
[ERROR] Resolving expression: '${java.release.version}': Detected the following recursive expression cycle in 'java.release.version': [java.release.version, java.test.release.version] @ 
[ERROR] Resolving expression: '${java.release.version}': Detected the following recursive expression cycle in 'java.release.version': [java.release.version, java.test.release.version] @ 
[ERROR] Resolving expression: '${java.release.version}': Detected the following recursive expression cycle in 'java.release.version': [java.release.version, java.test.release.version] @ 

	at org.apache.maven.model.building.DefaultModelProblemCollector.newModelBuildingException(DefaultModelProblemCollector.java:197)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:568)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:454)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:267)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:293)
	... 36 more


I'm keen to open a ticket if this is not specific to myself (e.g. having open spotbugs-maven-plugin in Eclipse previously)

@hazendaz
Copy link
Member

issue fixed now and will be released shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants