Bug 58375 - Data races inside class org.apache.coyote.Response
Data races inside class org.apache.coyote.Response
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 01:36 UTC by Yilong Li
Modified: 2015-09-14 19: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 01:36:02 UTC
Reported by RV-Predict (a dynamic race detector) when running the test suite:
Data race on field org.apache.coyote.Response.status: {{{
    Concurrent read in thread T216 (locks held: {Monitor@540b932c})
 ---->  at org.apache.coyote.Response.getStatus(Response.java:190)
        at org.apache.coyote.RequestInfo.updateCounters(RequestInfo.java:158)
        at org.apache.coyote.Request.updateCounters(Request.java:566)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1153)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:277)
        - locked Monitor@540b932c at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:259) 
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T216 is created by T214
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

    Concurrent write in thread T217 (locks held: {})
 ---->  at org.apache.coyote.Response.setStatus(Response.java:198)
        at org.apache.catalina.connector.Response.sendError(Response.java:1248)
        at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:468)
        at org.apache.catalina.core.TestAsyncContextImpl$AsyncErrorServlet$1.run(TestAsyncContextImpl.java:1381)
        at org.apache.catalina.core.AsyncContextImpl$RunnableWrapper.run(AsyncContextImpl.java:562)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T217 is created by T216
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)
}}}
Comment 1 Yilong Li 2015-09-12 07:40:47 UTC
One more report on Response.commited:
Data race on field org.apache.coyote.Response.commited: {{{
    Concurrent read in thread T38 (locks held: {Monitor@c32a9c3})
 ---->  at org.apache.coyote.Response.isCommitted(Response.java:219)
        at org.apache.catalina.connector.Response.isCommitted(Response.java:612)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
        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:673)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:277)
        - locked Monitor@c32a9c3 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:259) 
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T38 is created by T36
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

    Concurrent write in thread T39 (locks held: {})
 ---->  at org.apache.coyote.Response.setCommitted(Response.java:227)
        at org.apache.coyote.http11.InternalOutputBuffer.commit(InternalOutputBuffer.java:149)
        at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:741)
        at org.apache.coyote.Response.action(Response.java:179)
        at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:249)
        at org.apache.coyote.Response.doWrite(Response.java:503)
        at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:388)
        at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:315)
        at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:418)
        at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:406)
        at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:97)
        at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:90)
        at org.apache.catalina.connector.TestCoyoteAdapter$AsyncServlet$1.run(TestCoyoteAdapter.java:387)
    T39 is created by T38
        at org.apache.catalina.connector.TestCoyoteAdapter$AsyncServlet.doGet(TestCoyoteAdapter.java:409)
}}}
Comment 2 Mark Thomas 2015-09-14 19:46:46 UTC
The first one should have been fixed as part of the fix for bug 58371.
Comment 3 Mark Thomas 2015-09-14 19:57:24 UTC
Second issue fixed in trunk and 8.0.x for 8.0.27 onwards.