-
Notifications
You must be signed in to change notification settings - Fork 85
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
Execution default-cli of goal com.github.ferstl:depgraph-maven-plugin:3.3.1:graph failed.: ConcurrentModificationException #159
Comments
After I did the following, I got it to work:
Sorry for the false alarm! Edit: I'm a liar! Still having the issue. Not sure how I got it to work the one time... |
Actually, still happening for me even after clean install. Interestingly enough, exactly the same command runs fine in my terminal, which means there is something special in how VS Code extension runs it. /opt/java/apache-maven-3.6.1/bin/mvn -N com.github.ferstl:depgraph-maven-plugin:3.3.1:graph -DgraphFormat=text -DshowConflicts -DshowVersions -DshowGroupIds -DoutputDirectory="/Users/myuser/Library/Application Support/Code/User/workspaceStorage/fd0c3c196085f9c39b952636280de529/vscjava.vscode-maven" -DoutputFileName="f1b445acc55d9961eb54baded6d11987.deps.txt" -f /Users/myuser/git/gk2/media-handler/pom.xml I cannnot reproduce this issue at least by replicating the exact shell environment. But I can indirectly confirm that the bug does exist. The following modification does not fail any unit tests and allows this plug-in to run successfully via this extension:
|
Hi @ngrigoriev My only explanation for the exception is:
The reason why this exception is not reproducible could be a different dependency order which is somehow triggered by VS code or by running Cheers, |
@tonjohn @ngrigoriev Are your projects where this problems occurred publicly available. I am still interested in finding a way of reproducing the problem. |
Enabling `showDuplicates` and/or `showConflicts` introduces cycles in the dependency graph which could cause the recursive method `writeChildren()` to clear the list of edges while still iterating over it. Creating a copy of the list for iteration will solve this problem. Signed-off-by: Stefan Ferstl <st.ferstl@gmail.com>
…cation-exception #159 Fix ConcurrentModificationException in the text graph
Enabling `showDuplicates` and/or `showConflicts` introduces cycles in the dependency graph which could cause the recursive method `writeChildren()` to clear the list of edges while still iterating over it. Creating a copy of the list for iteration will solve this problem. Signed-off-by: Stefan Ferstl <st.ferstl@gmail.com>
#159 Fix ConcurrentModificationException in the text graph
I released version 3.3.2 with your suggested fix and informed the vscode-maven project. |
No, my project is private but I feel obliged to contribute as much as I can :) I tested first a couple of random spring boot demo projects from GitHub and could not get the issue reproducible (after reverting to the original 3.3.1 without the hack). So I took my original project, ran it through help:effective-pom. Then removes all code, removed all private references, randomized some values etc, so it is clean. I have removed all internal dependencies. The problem was still reproducible in VS Code. This build works fine if I run it manually (tried several different Maven versions):
It fails perfectly in VS Code as follows: VS Code info: Version: 1.69.2 Installed VS Code extensions: ban.spellright-3.0.72 Let me know if I can provide more information. |
@tonjohn I had a silly thought this morning and I was able to reproduce the issue without VS Code. I really wanted to understand what was going on since there are not too many things the parent process can do to the child to change its behavior - environment (no, verified that), stdin/stdout and that's all. So I decided to capture the exact thing. Turned out, VS Code runs the build like this:
Note the explicit /usr/bin/java invocation, which is 1.8 on my Mac. It seems VS Code (maven extension) does not configure the JVM properly - it is set to different one in the configuration. But I tested with other JVM versions using the same command - the problem is still reproducible with OpenJDK 11 and OpenJDK 18. After playing with this command I found that the real game changer is "-DshowDuplicates" flag. If I remove it, the problem does not seem to occur. Oddly enough, VS Code console does not seem to show this flag being used but, as you said, it is actually being used. Hope it helps. |
Enabling `showDuplicates` and/or `showConflicts` introduces cycles in the dependency graph which could cause the recursive method `writeChildren()` to clear the list of edges while still iterating over it. Creating a copy of the list for iteration will solve this problem. Signed-off-by: Stefan Ferstl <st.ferstl@gmail.com>
#159 Fix ConcurrentModificationException in the text graph
@ngrigoriev just confirmed that @ferstl unfortunately the project is private and NDA limits what I can share 😢 |
In debugging why the VSCode extension Maven for Java failed to load dependencies for one of the modules, I see that
com.github.ferstl:depgraph-maven-plugin:3.3.1:graph
is failing due to aConcurrentModificationException
being thrown atcom.github.ferstl.depgraph.graph.text.TextGraphFormatter$TextGraphWriter.writeChildren (TextGraphFormatter.java:107)
. None of the other modules in my project hit this error - they all work.Here (mavenUtils.ts:47) is the command that the Maven for Java extension runs when I click to expand the Dependencies list:
Detailed Error Logs
The text was updated successfully, but these errors were encountered: