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

Hang with SpotBugs plugin and fork=false #979

Open
rovarga opened this issue Apr 26, 2024 · 2 comments
Open

Hang with SpotBugs plugin and fork=false #979

rovarga opened this issue Apr 26, 2024 · 2 comments

Comments

@rovarga
Copy link

rovarga commented Apr 26, 2024

A parallel build invoking spotbugs-maven-plugin without forking ends up hanging build sometimes. A thread dump shows two build tasks attempting to lock a monitor:

"BuilderThread 3" #52 [174264] prio=5 os_prio=0 cpu=4139,05ms elapsed=2286,53s tid=0x00007fd300a2ab80 nid=174264 waiting for monitor entry  [0x00007fd4361fb000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at org.apache.tools.ant.taskdefs.Redirector.complete(Redirector.java:971)
    - waiting to lock <0x0000000433800000> (a java.lang.Object)
    at org.apache.tools.ant.taskdefs.Java.run(Java.java:893)
    at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:232)
    at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:136)
    at org.apache.tools.ant.taskdefs.Java.execute(Java.java:109)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
    at java.lang.invoke.LambdaForm$DMH/0x00007fd3e01fc000.invokeVirtual([email protected]/LambdaForm$DMH)
    at java.lang.invoke.LambdaForm$MH/0x00007fd3e1498c00.invoke([email protected]/LambdaForm$MH)
    at java.lang.invoke.Invokers$Holder.invokeExact_MT([email protected]/Invokers$Holder)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl([email protected]/DirectMethodHandleAccessor.java:153)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke([email protected]/DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke([email protected]/Method.java:580)
    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:151)

and

"BuilderThread 11" #60 [174272] prio=5 os_prio=0 cpu=3370,14ms elapsed=2286,53s tid=0x00007fd300a3a340 nid=174272 waiting for monitor entry  [0x00007fd4359fb000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at org.apache.tools.ant.taskdefs.Redirector.complete(Redirector.java:971)
    - waiting to lock <0x0000000433828660> (a java.lang.Object)
    at org.apache.tools.ant.taskdefs.Java.run(Java.java:893)
    at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:232)
    at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:136)
    at org.apache.tools.ant.taskdefs.Java.execute(Java.java:109)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
    at java.lang.invoke.LambdaForm$DMH/0x00007fd3e01fc000.invokeVirtual([email protected]/LambdaForm$DMH)
    at java.lang.invoke.LambdaForm$MH/0x00007fd3e1498c00.invoke([email protected]/LambdaForm$MH)
    at java.lang.invoke.Invokers$Holder.invokeExact_MT([email protected]/Invokers$Holder)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl([email protected]/DirectMethodHandleAccessor.java:153)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke([email protected]/DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke([email protected]/Method.java:580)
    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:151)

both objects mentioned are held in this context:

"In pipe (disconnected)" #109 [174409] daemon prio=5 os_prio=0 cpu=0,25ms elapsed=2277,97s tid=0x00007fd1f00059f0 nid=174409 in Object.wait()  [0x00007fd42bbfe000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait0([email protected]/Native Method)
    - waiting on <0x00000007ff2284e0> (a java.util.LinkedList)
    at java.lang.Object.wait([email protected]/Object.java:366)
    at java.lang.Object.wait([email protected]/Object.java:339)
    at org.mvndaemon.mvnd.daemon.Server$DaemonInputStream.read(Server.java:714)
    - locked <0x00000007ff2284e0> (a java.util.LinkedList)
    at java.io.InputStream.read([email protected]/InputStream.java:287)
    at java.io.FilterInputStream.read([email protected]/FilterInputStream.java:119)
    at org.apache.tools.ant.taskdefs.Redirector.handleInput(Redirector.java:868)
    - locked <0x0000000433828660> (a java.lang.Object)
    at org.apache.tools.ant.taskdefs.Java.handleInput(Java.java:809)
    at org.apache.tools.ant.UnknownElement.handleInput(UnknownElement.java:240)
    at org.apache.tools.ant.Project.demuxInput(Project.java:1327)
    at org.apache.tools.ant.DemuxInputStream.read(DemuxInputStream.java:73)
    at java.io.FilterInputStream.read([email protected]/FilterInputStream.java:119)
    at org.apache.tools.ant.taskdefs.Redirector.handleInput(Redirector.java:868)
    - locked <0x0000000433800000> (a java.lang.Object)
    at org.apache.tools.ant.taskdefs.Java.handleInput(Java.java:809)
    at org.apache.tools.ant.UnknownElement.handleInput(UnknownElement.java:240)
    at org.apache.tools.ant.Project.demuxInput(Project.java:1327)
    at org.apache.tools.ant.DemuxInputStream.read(DemuxInputStream.java:73)
    at java.io.InputStream.read([email protected]/InputStream.java:220)
    at org.ops4j.io.Pipe$Pump.run(Pipe.java:141)

This does not happen when SpotBugs is using forked mode, i.e. runs in a different JVM.

@rovarga
Copy link
Author

rovarga commented Apr 26, 2024

I guess DaemonInputStream is waiting for something to come from https://github.com/apache/maven-mvnd/blame/master/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java#L501, which never arrives.

@rovarga
Copy link
Author

rovarga commented Apr 26, 2024

full jstack output: spotbugs_deadlock.txt

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

1 participant