Comments (17)
@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?
from spotbugs-maven-plugin.
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
from spotbugs-maven-plugin.
https://github.com/spotbugs/spotbugs/blob/master/spotbugs/src/main/java/edu/umd/cs/findbugs/TextUICommandLine.java#L409 seems to confirms the 3 modules relies on System.in. Maybe we lack a synchronized block around https://github.com/spotbugs/spotbugs/blob/master/spotbugs/src/main/java/edu/umd/cs/findbugs/TextUICommandLine.java#L297, to easily circumvent such concurrent use of System.in
from spotbugs-maven-plugin.
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([email protected]/Native Method)
at java.io.FileInputStream.read([email protected]/FileInputStream.java:276)
at java.io.BufferedInputStream.read1([email protected]/BufferedInputStream.java:282)
at java.io.BufferedInputStream.read([email protected]/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([email protected]/StreamDecoder.java:270)
at sun.nio.cs.StreamDecoder.implRead([email protected]/StreamDecoder.java:313)
at sun.nio.cs.StreamDecoder.read([email protected]/StreamDecoder.java:188)
- locked <0x00000007010fb548> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read([email protected]/InputStreamReader.java:177)
at java.io.BufferedReader.fill([email protected]/BufferedReader.java:162)
at java.io.BufferedReader.readLine([email protected]/BufferedReader.java:329)
- locked <0x00000007010fb548> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine([email protected]/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([email protected]/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([email protected]/StreamDecoder.java:270)
at sun.nio.cs.StreamDecoder.implRead([email protected]/StreamDecoder.java:313)
at sun.nio.cs.StreamDecoder.read([email protected]/StreamDecoder.java:188)
- locked <0x00000007010282b8> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read([email protected]/InputStreamReader.java:177)
at java.io.BufferedReader.fill([email protected]/BufferedReader.java:162)
at java.io.BufferedReader.readLine([email protected]/BufferedReader.java:329)
- locked <0x00000007010282b8> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine([email protected]/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)
from spotbugs-maven-plugin.
Could we fix the indication spotbugs maven plugin is thread-safe for now?
https://github.com/spotbugs/spotbugs-maven-plugin/blob/spotbugs/src/main/groovy/org/codehaus/mojo/spotbugs/CheckMojo.groovy#L34
from spotbugs-maven-plugin.
from spotbugs-maven-plugin.
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.
from spotbugs-maven-plugin.
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.
from spotbugs-maven-plugin.
@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.
from spotbugs-maven-plugin.
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
'
from spotbugs-maven-plugin.
Here is the mvn code triggering the ant task triggering FindBugs2 (as visible in the stack):
ant.java(classname: "edu.umd.cs.findbugs.FindBugs2", inputstring: getSpotbugsAuxClasspath(), fork: "${fork}", failonerror: "true", clonevm: "false", timeout: "${timeout}", maxmemory: "${maxHeap}m") {
from spotbugs-maven-plugin.
Maybe the issue is the empty -auxclasspathFromInput
in
if(!sarifOutput) {
args << "-xml:withMessages=" + tempFile.getAbsolutePath()
}
else {
args << "-sarif=" + tempFile.getAbsolutePath()
}
args << "-auxclasspathFromInput"
args << "-projectName"
args << "${project.name}"
from spotbugs-maven-plugin.
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
from spotbugs-maven-plugin.
from spotbugs-maven-plugin.
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...
from spotbugs-maven-plugin.
This fix is available in spotbugs-maven-plugin 4.7.3.1
Thanks
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)
from spotbugs-maven-plugin.
issue fixed now and will be released shortly.
from spotbugs-maven-plugin.
Related Issues (20)
- Extraneous "following classes needed for analysis were missing" message introduced in 4.7.3.1? HOT 3
- SuppressFBWarnings is ignored HOT 10
- spotbugs:gui not working HOT 3
- Extend via dependencies rather than custom configuration HOT 8
- Uses deprecated maven components HOT 8
- Does spotbugs report plugin support aggregation HOT 2
- Review replacing usage of 'ant'
- FindBugsAntBuildLogic 3.7 generates invalid findbugs_report.xml file HOT 2
- java 22 support will be in groovy 4.0.16 which isn't out yet HOT 2
- plugin build setting HOT 8
- makeConcatWithConstants + apply classes needed for analysis were missing HOT 1
- check does not fail if called as defaultGoal of profile HOT 4
- Build repeats "Unable to create Maven project for" warning and fails HOT 5
- NOTICE: Maven support will be moved to 3.6.3 as minimum on next release
- Sporadic spotbugs failure
- Spotbugs Maven Plugin 4.8.4 waiting on groovy! HOT 1
- Support the `chooseVisitors` option
- Is there a way to configure an accepted number of errors in order to introduce spotbugs into existing projects HOT 2
- All documentation descriptions are empty HOT 1
- After recent updates in core libraries ad plugin `verify` and `spotbugs:check` works differently
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spotbugs-maven-plugin.