[ 
https://jira.codehaus.org/browse/MCHECKSTYLE-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=315090#comment-315090
 ] 

Ronald Chen commented on MCHECKSTYLE-138:
-----------------------------------------

This plugin is not thread-safe.

I ran into an issue where two threads were trying to access the same static 
unsynchronzied hash map.

I am using version 2.6 and multiple threads stuck in:
"pool-1-thread-1" prio=10 tid=0x00007fd128342000 nid=0x3f7 runnable 
[0x00007fd12c86c000]
   java.lang.Thread.State: RUNNABLE
        at java.util.HashMap.get(HashMap.java:303)
        at com.puppycrawl.tools.checkstyle.api.Utils.getPattern(Utils.java:161)
        at com.puppycrawl.tools.checkstyle.api.Utils.getPattern(Utils.java:144)
        at 
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.setOffCommentFormat(SuppressionCommentFilter.java:316)
        at 
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.<init>(SuppressionCommentFilter.java:303)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at 
com.puppycrawl.tools.checkstyle.PackageObjectFactory.createObject(PackageObjectFactory.java:114)
        at 
com.puppycrawl.tools.checkstyle.PackageObjectFactory.doMakeObject(PackageObjectFactory.java:92)
        at 
com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:148)
        at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:152)
        at 
com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:207)
        at 
org.apache.maven.plugin.checkstyle.DefaultCheckstyleExecutor.executeCheckstyle(DefaultCheckstyleExecutor.java:174)
        at 
org.apache.maven.plugin.checkstyle.CheckstyleViolationCheckMojo.execute(CheckstyleViolationCheckMojo.java:380)
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at 
org.apache.maven.lifecycle.internal.LifecycleThreadedBuilder$1.call(LifecycleThreadedBuilder.java:167)
        at 
org.apache.maven.lifecycle.internal.LifecycleThreadedBuilder$1.call(LifecycleThreadedBuilder.java:163)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

My info:
$ mvn -v
Apache Maven 3.0.4 (r1232337; 2012-01-17 00:44:56-0800)
Maven home: /home/rchen/dev/tools/apache-maven-3.0.4
Java version: 1.6.0_26, vendor: Sun Microsystems Inc.
Java home: /home/rchen/dev/tools/jdk1.6.0_26/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "2.6.36-020636-generic", arch: "amd64", family: 
"unix"

                
> Checkstyle plugin is @threadSafe if checkstyle itself is threadsafe
> -------------------------------------------------------------------
>
>                 Key: MCHECKSTYLE-138
>                 URL: https://jira.codehaus.org/browse/MCHECKSTYLE-138
>             Project: Maven 2.x Checkstyle Plugin
>          Issue Type: Improvement
>            Reporter: Kristian Rosenvold
>
> The checkstyle plugin can be marked as threadSafe if checkstyle itself can be 
> verified to be thread safe.
> "Someone" should ask the checkstyle community if this is the case.

--
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