[ 
https://issues.apache.org/jira/browse/MPMD-408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17893421#comment-17893421
 ] 

AB-xdev commented on MPMD-408:
------------------------------

I was able to reproduce the problem with different maven parallelization/thread 
configurations (-T8, -T1, ...) on the same machine but not on others. 
The amount of spawned PMD threads does NOT depend on the selected maven 
parallelization and is ALWAYS the same amount as CPU threads 
({{Runtime.getRuntime().availableProcessors()}}).
It's likely some unfortunate CPU situation that only occurs on certain machines 
with certain code.

I inspected another Threaddump [^Threaddump2.txt] further and as far as i can 
tell the problem is a legitimate PMD problem.
It looks like multiple threads are started for analysis, which process 
different classes/pieces of code and walk through related code.
While they are being processed the threads (sometimes) lock each other, 
resulting in a deadlock:

Example from the Threaddump: 
{noformat}
Thread #1: Class A (locked) -> ... -> Class C (waits for lock from Thread #16)
Thread #16: Class C (locked) -> Class A (waits for lock from Thread #1)
→ Deadlock
{noformat}

(for more details see the deadlock section at the end of the attached Thread 
dump)


> Deadlock with pmd 7.7.0 when executing parallel builds
> ------------------------------------------------------
>
>                 Key: MPMD-408
>                 URL: https://issues.apache.org/jira/browse/MPMD-408
>             Project: Maven PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 3.25.0
>         Environment: Java 21
> Maven 3.9
> Windows
> private Multi Maven Project with around 15 modules and 30k LoC
>            Reporter: AB-xdev
>            Priority: Critical
>             Fix For: waiting-for-feedback
>
>         Attachments: MvnPMDDeadlock.avif, Threaddump.txt, Threaddump2.txt, 
> screenshot-1.png
>
>
> We are executing the following on a multi-Maven project:
> {{mvn -B test pmd:check -P pmd -DskipTests -T2C}}
> Which causes a deadlock (most of the time):
>  [^MvnPMDDeadlock.avif] 
> Here's the Threaddump:
>  [^Threaddump.txt] 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to