-
Notifications
You must be signed in to change notification settings - Fork 77
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
ConcurrentModificationException
while running dryRun
with mvnd
#780
Comments
Hi @motlin! In your project are you running multiple modules/plugins in parallel? There's no threading in the OpenRewrite Maven build plugin, but it looks like the Maven project's resources are getting modified out from under the plugin itself based on the stacktrace. |
Hi @shanman190, yes I'm running The rewrite plugin is explicitly marked thread-safe: https://github.com/search?q=repo%3Aopenrewrite%2Frewrite-maven-plugin%20threadSafe&type=code |
Oh wow, that's quite unfortunate; I must admit I hadn't tried |
ConcurrentModificationException
while running dryRun
with mvnd
In clicking through the stack trace I'm a bit puzzled why our use of rewrite-maven-plugin/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java Lines 404 to 407 in a482eff
I don't think there's very much we could do differently, seeing how the CCME is triggered on this line in Apache Maven: Does the same work for you if you use |
The
Still not sure if that's something we'd have much control over. 🤔 |
I would think the phases would happen in a serial fashion within each module independently as that particular module works toward the specified goal. To me this feels like a plugin that is modifying the current module's configuration within a separate thread or an entirely separate plugin in some other module running at the same time is crossing the module boundary. But I don't know for sure. From the Maven docs, they state that the entirety of Maven proper is all thread safe, but they can make no guarantees on plugins and their specific behavior. |
Because of the nature of this as a concurrency problem, I don't run into it frequently and haven't reproduced it with It's always possible to make a maven plugin thread-safe but it would be difficult to do it reliably without understanding the problem better. For example, we could add |
I think the problem here is OpenRewrite + something else. I'm not sure what the something else part of the equation is though. From an OpenRewrite standpoint, we are reading the dependencies -- as noted by Tim -- while something else is modifying the module's dependencies. Given Maven proper is all thread safe, my only remaining idea is some other plugin of either the current module or a plugin somewhere else in the Maven build is the one that is violating the thread safety here. |
Not sure if it helps, but same error happens with Gradle run as well. This can be reproduced on repo - https://github.com/iamrakesh/vfs-s3/tree/add-gradle-nature Using below Gradle command
Using below Maven command
|
@iamrakesh, so the the issue that you're seeing there is similar, but not actually related to the issue being described here. While your issue is also a
This error should be reported against the https://github.com/aws/aws-sdk-java-v2 repository where those OpenRewrite recipes are being maintained. |
Thank you for checking it (y), I see one has already been created for it - aws/aws-sdk-java-v2#5666 |
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a multi module project.
The command I ran was
mvnd install org.openrewrite.maven:rewrite-maven-plugin:dryRun --projects '!liftwizard-example' --activate-profiles 'rewrite-maven-plugin-strict,rewrite-maven-plugin-dryRun' -DskipTests
What is the full stack trace of any errors you encountered?
The text was updated successfully, but these errors were encountered: