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

[java] Intermittent PMD failure : PMD processing errors while no violations reported #1460

Closed
avivmu opened this Issue Nov 13, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@avivmu
Copy link

avivmu commented Nov 13, 2018

PMD Version: 6.8.0

Description: This is an intermittent bug not happening all the time, see attached log
Running PMD through: Maven

[DEBUG] Executing PMD...
Nov 13, 2018 12:32:32 PM net.sourceforge.pmd.cache.AbstractAnalysisCache checkValidity
INFO: Analysis cache invalidated, rulesets changed.
Nov 13, 2018 12:32:32 PM net.sourceforge.pmd.cache.AbstractAnalysisCache checkValidity
INFO: Analysis cache invalidated, execution classpath changed.
Nov 13, 2018 12:32:36 PM net.sourceforge.pmd.cache.FileAnalysisCache persist
INFO: Analysis cache updated
[DEBUG] PMD finished. Found 0 violations.
[ERROR] PMD processing errors:
[ERROR] BlaBla.java: Error while processing
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:102)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:51)
at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:78)
at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:24)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: java.util.HashMap$Node cannot be cast to java.util.HashMap$TreeNode
at java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1827)
at java.util.HashMap$TreeNode.treeify(HashMap.java:1944)
at java.util.HashMap.treeifyBin(HashMap.java:771)
at java.util.HashMap.putVal(HashMap.java:643)
at java.util.HashMap.put(HashMap.java:611)
at net.sourceforge.pmd.lang.java.typeresolution.typedefinition.JavaTypeDefinition.forClass(JavaTypeDefinition.java:79)
at net.sourceforge.pmd.lang.java.ast.AbstractAnyTypeDeclaration.setQualifiedName(AbstractAnyTypeDeclaration.java:85)
at net.sourceforge.pmd.lang.java.qname.QualifiedNameResolver.visit(QualifiedNameResolver.java:212)
at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorReducedAdapter.visit(JavaParserVisitorReducedAdapter.java:16)
at net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration.jjtAccept(ASTClassOrInterfaceDeclaration.java:55)
at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:206)
at net.sourceforge.pmd.lang.java.ast.ASTTypeDeclaration.jjtAccept(ASTTypeDeclaration.java:37)
at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:181)
at net.sourceforge.pmd.lang.java.qname.QualifiedNameResolver.visit(QualifiedNameResolver.java:134)
at net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit.jjtAccept(ASTCompilationUnit.java:41)
at net.sourceforge.pmd.lang.java.qname.QualifiedNameResolver.initializeWith(QualifiedNameResolver.java:118)
at net.sourceforge.pmd.lang.java.AbstractJavaHandler$8.start(AbstractJavaHandler.java:140)
at net.sourceforge.pmd.SourceCodeProcessor.resolveQualifiedNames(SourceCodeProcessor.java:125)

@jsotuyod jsotuyod added the a:bug label Nov 13, 2018

@jsotuyod jsotuyod added this to the 6.10.0 milestone Nov 13, 2018

@jsotuyod

This comment has been minimized.

Copy link
Member

jsotuyod commented Nov 13, 2018

@avivmu thanks for the report! Indeed, we have a concurrency error on

private static final Map<Class<?>, JavaTypeDefinition> CLASS_EXACT_TYPE_DEF_CACHE = new HashMap<>();

I'll change the HashMap to ConcurrentHashMap for 6.10.0 and it should work just fine.

@jsotuyod jsotuyod self-assigned this Nov 13, 2018

jsotuyod added a commit to Monits/pmd that referenced this issue Nov 13, 2018

@jsotuyod jsotuyod added the has:pr label Nov 13, 2018

jsotuyod added a commit to Monits/pmd that referenced this issue Nov 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment