Bug 58380 - Data races inside org.apache.catalina.session.StandardSession
Data races inside org.apache.catalina.session.StandardSession
Status: RESOLVED FIXED
Product: Tomcat 8
Classification: Unclassified
Component: Catalina
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 07:59 UTC by Yilong Li
Modified: 2015-09-15 10:57 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 07:59:10 UTC
Reported by RV-Predict (a dynamic race detector) when running the test suite:
Data race on field org.apache.catalina.session.StandardSession.maxInactiveInterval: {{{
    Concurrent read in thread T40 (locks held: {})
 ---->  at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:701)
        at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:570)
        at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:555)
        at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5537)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1377)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1349)
    T40 is created by T1
        at org.apache.catalina.core.ContainerBase.threadStart(ContainerBase.java:1299)

    Concurrent write in thread T1 (locks held: {})
 ---->  at org.apache.catalina.session.StandardSession.setMaxInactiveInterval(StandardSession.java:607)
        at org.apache.catalina.authenticator.TestSSOnonLoginAndBasicAuthenticator.doImminentSessionTimeout(TestSSOnonLoginAndBasicAuthenticator.java:599)
        at org.apache.catalina.authenticator.TestSSOnonLoginAndBasicAuthenticator.testBasicExpiredAcceptProtectedWithCookies(TestSSOnonLoginAndBasicAuthenticator.java:340)
        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.catalina.session.StandardSession.maxInactiveInterval: {{{
    Concurrent read in thread T40 (locks held: {})
 ---->  at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:703)
        at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:570)
        at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:555)
        at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5537)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1377)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1349)
    T40 is created by T1
        at org.apache.catalina.core.ContainerBase.threadStart(ContainerBase.java:1299)

    Concurrent write in thread T1 (locks held: {})
 ---->  at org.apache.catalina.session.StandardSession.setMaxInactiveInterval(StandardSession.java:607)
        at org.apache.catalina.authenticator.TestSSOnonLoginAndBasicAuthenticator.doImminentSessionTimeout(TestSSOnonLoginAndBasicAuthenticator.java:599)
        at org.apache.catalina.authenticator.TestSSOnonLoginAndBasicAuthenticator.testBasicExpiredAcceptProtectedWithCookies(TestSSOnonLoginAndBasicAuthenticator.java:340)
        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
}}}
Comment 1 Yilong Li 2015-09-12 16:17:55 UTC
Two more reports on StandardSession.isNew:
Data race on field org.apache.catalina.session.StandardSession.isNew: {{{
    Concurrent read in thread T1 (locks held: {Monitor@76187037, Monitor@76176512, Monitor@76176549})
 ---->  at org.apache.catalina.session.StandardSession.doWriteObject(StandardSession.java:1679)
        at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1116)
        at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:401)
        - locked Monitor@76176549 at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:389)
        at org.apache.catalina.session.StandardManager.unload(StandardManager.java:320)
        at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:487)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        - locked Monitor@76176512 at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:n/a)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5386)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3739)
        - locked Monitor@76187037 at org.apache.catalina.core.StandardContext.reload(StandardContext.java:n/a)
        at org.apache.catalina.mapper.TestMapperWebapps.testContextReload_Bug56658_Bug56882(TestMapperWebapps.java:135)
        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

    Concurrent write in thread T43 (locks held: {Monitor@3d245712})
 ---->  at org.apache.catalina.session.StandardSession.endAccess(StandardSession.java:749)
        at org.apache.catalina.connector.Request.recycle(Request.java:496)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:581)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:279)
        - locked Monitor@3d245712 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:259)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T43 is created by T42
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)
}}} 

Data race on field org.apache.catalina.session.StandardSession.isNew: {{{
    Concurrent write in thread T43 (locks held: {Monitor@3d245712})
 ---->  at org.apache.catalina.session.StandardSession.endAccess(StandardSession.java:749)
        at org.apache.catalina.connector.Request.recycle(Request.java:496)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:581)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:279)
        - locked Monitor@3d245712 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:259)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T43 is created by T42
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

    Concurrent write in thread T1 (locks held: {Monitor@76187037, Monitor@76176512})
 ---->  at org.apache.catalina.session.StandardSession.recycle(StandardSession.java:1021)
        at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:436)
        at org.apache.catalina.session.StandardManager.unload(StandardManager.java:320)
        at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:487)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        - locked Monitor@76176512 at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:n/a)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5386)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3739)
        - locked Monitor@76187037 at org.apache.catalina.core.StandardContext.reload(StandardContext.java:n/a)
        at org.apache.catalina.mapper.TestMapperWebapps.testContextReload_Bug56658_Bug56882(TestMapperWebapps.java:135)
        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
}}}
Comment 2 Mark Thomas 2015-09-15 10:57:30 UTC
Fixed in trunk and 8.0.x for 8.0.27 onwards.