Bug 58389 - Data race on field org.apache.tomcat.util.threads.TaskQueue.parent
Data race on field org.apache.tomcat.util.threads.TaskQueue.parent
Status: RESOLVED FIXED
Product: Tomcat 8
Classification: Unclassified
Component: Util
8.0.x-trunk
PC Linux
: P2 normal (vote)
: ----
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2015-09-12 16:34 UTC by Yilong Li
Modified: 2015-09-17 08:40 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yilong Li 2015-09-12 16:34:50 UTC
Reported by RV-Predict (a dynamic race detector) when running the test suite:
Data race on field org.apache.tomcat.util.threads.TaskQueue.parent: {{{
    Concurrent read in thread T48 (locks held: {Monitor@23069647})
 ---->  at org.apache.tomcat.util.threads.TaskQueue.force(TaskQueue.java:63)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:166)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:141)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:306)
        - locked Monitor@23069647 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:259)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T48 is created by T47
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

    Concurrent write in thread T1 (locks held: {Monitor@23f9dda5, Monitor@23f9da07, Monitor@23f9da2f, Monitor@23f9ec39})
 ---->  at org.apache.tomcat.util.threads.TaskQueue.setParent(TaskQueue.java:54)
        at org.apache.tomcat.util.net.AbstractEndpoint.shutdownExecutor(AbstractEndpoint.java:596)
        at org.apache.tomcat.util.net.JIoEndpoint.stopInternal(JIoEndpoint.java:417)
        at org.apache.tomcat.util.net.AbstractEndpoint.stop(AbstractEndpoint.java:809)
        at org.apache.coyote.AbstractProtocol.stop(AbstractProtocol.java:516)
        at org.apache.catalina.connector.Connector.stopInternal(Connector.java:1011)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        - locked Monitor@23f9ec39 at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:n/a)
        at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:516)
        - locked Monitor@23f9da2f at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:506)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        - locked Monitor@23f9da07 at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:n/a)
        at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:790)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        - locked Monitor@23f9dda5 at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:n/a)
        at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:347)
        at org.apache.catalina.startup.TomcatBaseTest.tearDown(TomcatBaseTest.java:212)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
        at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:535)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1182)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1033)
    T1 is the main thread
}}}
Comment 1 Yilong Li 2015-09-13 21:41:30 UTC
Since TaskQueue extends LinkedBlockingQueue, I think it should be thread-safe internally.
Comment 2 Mark Thomas 2015-09-17 08:40:20 UTC
Fixed in trunk and 8.0.x for 8.0.27 onwards.