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

install4j-maven-plugin is not thread-safe #31

Open
lasselindqvist opened this issue Apr 25, 2019 · 2 comments
Open

install4j-maven-plugin is not thread-safe #31

lasselindqvist opened this issue Apr 25, 2019 · 2 comments

Comments

@lasselindqvist
Copy link

AntHelper.java seems to use outputstreams in such a way that the outputs might get mixed up with outputs from other running tasks.

This becomes a problem when trying to run the plugin as part of a multithreaded Maven build. It might fail to:

[2019-04-25T10:16:52.515Z] [ERROR] Failed to execute goal org.sonatype.install4j:install4j-maven-plugin:1.0.8:compile (compile-installers)
on project install4j: Unable to parse version from input: Picked up JAVA_TOOL_OPTIONS:
-Dmaven.ext.class.path="pipeline-maven-spy.jar"
-Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder="withMavene6640721"
install4j version 6.1.2 (build 6275), built on 2016-06-21 -> [Help 1]

The Exception is thrown here: https://github.com/sonatype/install4j-support/blob/master/install4j-maven-plugin/src/main/java/org/sonatype/install4j/maven/VersionHelper.java#L87
and if I understand correctly, the root of the problem is AntHelper
https://github.com/sonatype/install4j-support/blob/master/install4j-maven-plugin/src/main/java/org/sonatype/install4j/maven/AntHelper.java#L64

It seems to me that MavenAntLoggerAdapter is used and the output of calls is redirected to standard output where it mingles with other texts failing the version parsing.

Maybe the output could be redirected to a temporary file and read from there or fixed in some other way?

@rkohser
Copy link

rkohser commented Jan 14, 2021

Hi, I am running into the same issue with some race condition preventing compilation some times. Have you found a workaround ?

@lasselindqvist
Copy link
Author

I have actually done a workaround in a private fork. It uses a temp file to write the version. But honestly the whole check is unnecessarily and could be removed (

versionHelper.ensureVersionCompatible(ant.getProperty(versionProperty));
) if you just trust that you have the necessary version.

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

2 participants