Bug 58388 - Data race on field org.apache.coyote.RequestInfo.stage
Data race on field org.apache.coyote.RequestInfo.stage
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 16:32 UTC by Yilong Li
Modified: 2015-09-17 08:20 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:32:42 UTC
Reported by RV-Predict (a dynamic race detector) when running the test suite:
Data race on field org.apache.coyote.RequestInfo.stage: {{{
    Concurrent read in thread T21 (locks held: {})
 ---->  at org.apache.coyote.RequestInfo.getStage(RequestInfo.java:172)
        at org.apache.coyote.http11.Http11Nio2Processor.actionInternal(Http11Nio2Processor.java:520)
        at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:924)
        at org.apache.coyote.Request.action(Request.java:380)
        at org.apache.catalina.connector.Request.cometClose(Request.java:2583)
        at org.apache.catalina.connector.CometEventImpl.close(CometEventImpl.java:98)
        at org.apache.catalina.comet.TestCometProcessor$AsyncCometCloseThread.run(TestCometProcessor.java:665)
    T21 is created by T20
        at org.apache.catalina.comet.TestCometProcessor$AsyncCometCloseValve.invoke(TestCometProcessor.java:648)

    Concurrent write in thread T20 (locks held: {Monitor@78eabf38})
 ---->  at org.apache.coyote.RequestInfo.setStage(RequestInfo.java:176)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1129)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
        at org.apache.tomcat.util.net.Nio2Endpoint$SocketProcessor.doRun(Nio2Endpoint.java:1074)
        at org.apache.tomcat.util.net.Nio2Endpoint$SocketProcessor.run(Nio2Endpoint.java:1033)
        - locked Monitor@78eabf38 at org.apache.tomcat.util.net.Nio2Endpoint$SocketProcessor.run(Nio2Endpoint.java:1032)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T20 is created by T19
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)
}}}
Comment 1 Yilong Li 2015-09-13 21:37:08 UTC
I don't know enough about the code here but shouldn't such "state" variable be declared as volatile or atomic to avoid memory visibility issues when altering state?
Comment 2 Mark Thomas 2015-09-17 08:20:33 UTC
Fixed in 8.0.x for 8.0.27 onwards.