Ryan Heinen created MPMD-159:
--------------------------------

             Summary: Threadsafety issue when used in parallel builds
                 Key: MPMD-159
                 URL: https://jira.codehaus.org/browse/MPMD-159
             Project: Maven 2.x PMD Plugin
          Issue Type: Bug
    Affects Versions: 2.7.1, 2.8
            Reporter: Ryan Heinen
         Attachments: doxia-1.3-upgrade.patch

Using the maven-pmd-plugin during a parallel maven build can produce the 
following error:

{code}
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-pmd-plugin:2.8-SNAPSHOT:pmd (pmd) on project 
<projectname>: An error has occurred in PMD Report report generation. Could not 
find the template 
'org/apache/maven/doxia/siterenderer/resources/default-site.vm: 
NullPointerException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
{code}

Reproducibility of this problem appears to be based on the reactor structure 
and how parallelizable it is. I will try to create a test case that reproduces 
this problem consistently. At times it is 100% reproducible, but then a small 
change to the reactor configuration (eg. add a project) will cause the error to 
disappear.

I believe that this bug is caused by thread safety issues in the velocity 
library that is used by doxia.

Upgrading doxia dependencies to version 1.3 appears to resolve this bug. 
Although the version of velocity used by doxia 1.3 is still the same, 
velocity-tools been introduced.

In version 1.3, instead of newing the VelocityContext directly, 
doxia-site-renderer uses ToolManager.getContext, which delegates to 
ToolboxFactory to do some initialization. This initialization logic is 
protected with synchronization, which may explain why the bug seems to go away 
after the upgrade.

I've included a patch that applies against trunk of the maven-pmd-plugin which 
upgrades doxia from version 1.1.3 to 1.3.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to