Bug 58370 - Data race on field org.apache.tomcat.util.net.AbstractEndpoint.executor
Data race on field org.apache.tomcat.util.net.AbstractEndpoint.executor
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 01:18 UTC by Yilong Li
Modified: 2015-09-14 09:48 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 01:18:59 UTC
Reported by RV-Predict (a dynamic race detector) when running the test suite:
Data race on field org.apache.tomcat.util.net.AbstractEndpoint.executor: {{{
    Concurrent read in thread T26 (locks held: {Monitor@3fa4c950})
 ---->  at org.apache.tomcat.util.net.AbstractEndpoint.getCurrentThreadsBusy(AbstractEndpoint.java:548)
        at org.apache.coyote.http11.Http11Processor.disableKeepAlive(Http11Processor.java:111)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:994)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:279)
        - locked Monitor@3fa4c950 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:259) 
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T26 is created by T24
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

    Concurrent write in thread T1 (locks held: {Monitor@24ff6454})
 ---->  at org.apache.tomcat.util.net.AbstractEndpoint.shutdownExecutor(AbstractEndpoint.java:598)
        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@24ff6454 at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:n/a) 
        at org.apache.catalina.connector.TestConnector.testStop(TestConnector.java:61)
        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.InvokeMethod.evaluate(InvokeMethod.java:17)
        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.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
}}}

Data race on field org.apache.tomcat.util.net.AbstractEndpoint.executor: {{{
    Concurrent read in thread T26 (locks held: {Monitor@3fa4c950})
 ---->  at org.apache.tomcat.util.net.AbstractEndpoint.getMaxThreadsExecutor(AbstractEndpoint.java:409)
        at org.apache.tomcat.util.net.AbstractEndpoint.getMaxThreads(AbstractEndpoint.java:404)
        at org.apache.coyote.http11.Http11Processor.disableKeepAlive(Http11Processor.java:110)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:994)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:279)
        - locked Monitor@3fa4c950 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:259) 
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T26 is created by T24
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

    Concurrent write in thread T1 (locks held: {Monitor@24ff6454})
 ---->  at org.apache.tomcat.util.net.AbstractEndpoint.shutdownExecutor(AbstractEndpoint.java:598)
        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@24ff6454 at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:n/a) 
        at org.apache.catalina.connector.TestConnector.testStop(TestConnector.java:61)
        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.InvokeMethod.evaluate(InvokeMethod.java:17)
        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.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
}}}

Data race on field org.apache.tomcat.util.net.AbstractEndpoint.executor: {{{
    Concurrent read in thread T24 (locks held: {Monitor@3fa4c950})
 ---->  at org.apache.tomcat.util.net.AbstractEndpoint.getExecutor(AbstractEndpoint.java:288)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:306)
        - locked Monitor@3fa4c950 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:259) 
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T24 is created by T22
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

    Concurrent write in thread T1 (locks held: {Monitor@24ff6454})
 ---->  at org.apache.tomcat.util.net.AbstractEndpoint.shutdownExecutor(AbstractEndpoint.java:598)
        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@24ff6454 at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:n/a) 
        at org.apache.catalina.connector.TestConnector.testStop(TestConnector.java:61)
        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.InvokeMethod.evaluate(InvokeMethod.java:17)
        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.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
}}}

Looks like the data race only happens upon shutdownExecutor.
Comment 1 Mark Thomas 2015-09-14 09:48:05 UTC
Fixed in trunk and 8.0.x for 8.0.27 onwards.