Bug 58372 - Data race on field org.apache.catalina.connector.OutputBuffer.suspended
Data race on field org.apache.catalina.connector.OutputBuffer.suspended
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:28 UTC by Yilong Li
Modified: 2015-09-14 16:14 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:28:55 UTC
Reported by RV-Predict (a dynamic race detector) when running the test suite:
Data race on field org.apache.catalina.connector.OutputBuffer.suspended: {{{
    Concurrent read in thread T115 (locks held: {})
 ---->  at org.apache.catalina.connector.OutputBuffer.isSuspended(OutputBuffer.java:200)
        at org.apache.catalina.connector.Response.isSuspended(Response.java:400)
        at org.apache.catalina.connector.Response.isAppCommitted(Response.java:341)
        at org.apache.catalina.connector.ResponseFacade.isCommitted(ResponseFacade.java:345)
        at org.apache.catalina.connector.ResponseFacade.setHeader(ResponseFacade.java:542)
        at org.apache.catalina.core.TestAsyncContextImpl$Bug50753Servlet$1.run(TestAsyncContextImpl.java:1153)
        at org.apache.catalina.core.AsyncContextImpl$RunnableWrapper.run(AsyncContextImpl.java:562)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T115 is created by T114
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

    Concurrent write in thread T114 (locks held: {Monitor@4c031101})
 ---->  at org.apache.catalina.connector.OutputBuffer.setSuspended(OutputBuffer.java:210)
        at org.apache.catalina.connector.Response.setSuspended(Response.java:392)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:167)
        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:673)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:277)
        - locked Monitor@4c031101 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:259) 
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    T114 is created by T112
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)
}}}
Comment 1 Yilong Li 2015-09-12 07:42:29 UTC
One more report:

Data race on field org.apache.catalina.connector.OutputBuffer.suspended: {{{
    Concurrent write in thread T38 (locks held: {Monitor@c32a9c3})
 ---->  at org.apache.catalina.connector.OutputBuffer.setSuspended(OutputBuffer.java:210)
        at org.apache.catalina.connector.Response.setSuspended(Response.java:392)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:167)
        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: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 read in thread T39 (locks held: {})
 ---->  at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:402)
        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 Yilong Li 2015-09-12 15:59:12 UTC
Another race on OutputBuffer.closed:
Data race on field org.apache.catalina.connector.OutputBuffer.closed: {{{
    Concurrent write in thread T21 (locks held: {})
 ---->  at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:297)
        at org.apache.catalina.connector.Response.finishResponse(Response.java:453)
        at org.apache.catalina.connector.CometEventImpl.close(CometEventImpl.java:96)
        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 read in thread T20 (locks held: {Monitor@78eabf38})
 ---->  at org.apache.catalina.connector.OutputBuffer.isClosed(OutputBuffer.java:220)
        at org.apache.catalina.connector.Response.isClosed(Response.java:408)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
        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.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 3 Mark Thomas 2015-09-14 16:14:24 UTC
Fixed in trunk and 8.0.x for 8.0.27 onwards.