Bug 58320 - Data race inside the non-thread-safe HashMap org.apache.catalina.connector.Request.attributes
Data race inside the non-thread-safe HashMap org.apache.catalina.connector.Re...
Status: RESOLVED FIXED
Product: Tomcat 8
Classification: Unclassified
Component: Catalina
8.0.24
PC Linux
: P2 normal (vote)
: ----
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2015-09-03 10:00 UTC by Yilong Li
Modified: 2015-09-03 20:17 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-03 10:00:32 UTC
Reported by RV-Predict (a dynamic race detector) when running the test suite:

Data race on field java.util.HashMap.$state: {{{
Concurrent read in thread T122 (locks held: {Monitor@5d0626be})
 ---->  at org.apache.catalina.connector.Request.getAttribute(Request.java:876)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:277)
        - locked Monitor@5d0626be at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:259)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T122 is created by T120
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

Concurrent write in thread T123 (locks held: {})
 ---->  at org.apache.catalina.connector.Request.setAttribute(Request.java:1480)
        at org.apache.catalina.core.AsyncContextImpl.dispatch(AsyncContextImpl.java:192)
        at org.apache.catalina.core.AsyncContextImpl.dispatch(AsyncContextImpl.java:178)
        at org.apache.catalina.core.TestAsyncContextImpl$Bug53337ServletB$1.run(TestAsyncContextImpl.java:1456)
    T123 is created by T122
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)
}}}
Comment 1 Mark Thomas 2015-09-03 20:17:08 UTC
Thanks for the report. This is fixed in trunk, 8.0.x (for 8.0.27 onwards) and 7.0.x (for 7.0.65 onwards).