Bug 58401 - Potential data race inside the data array used in org.apache.catalina.tribes.io.ChannelData & org.apache.catalina.tribes.membership.MemberImpl
Summary: Potential data race inside the data array used in org.apache.catalina.tribes....
Status: RESOLVED DUPLICATE of bug 58395
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.0.x-trunk
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-12 17:44 UTC by Yilong Li
Modified: 2015-09-18 09:23 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 17:44:28 UTC
Reported by RV-Predict (a dynamic race detector) when running the test suite:
Data race on array element #16: {{{
    Concurrent read in thread T47 (locks held: {Monitor@7ccb7286, Monitor@7ccb7255, Monitor@258500df})
 ---->  at org.apache.catalina.tribes.io.ChannelData.getDataPackage(ChannelData.java:216)
        at org.apache.catalina.tribes.io.XByteBuffer.createDataPackage(XByteBuffer.java:350)
        at org.apache.catalina.tribes.transport.nio.ParallelNioSender.sendMessage(ParallelNioSender.java:68)
        - locked Monitor@258500df at org.apache.catalina.tribes.transport.nio.ParallelNioSender.sendMessage(ParallelNioSender.java:n/a) 
        at org.apache.catalina.tribes.transport.nio.PooledParallelSender.sendMessage(PooledParallelSender.java:51)
        at org.apache.catalina.tribes.transport.ReplicationTransmitter.sendMessage(ReplicationTransmitter.java:54)
        at org.apache.catalina.tribes.group.ChannelCoordinator.sendMessage(ChannelCoordinator.java:82)
        at org.apache.catalina.tribes.group.ChannelInterceptorBase.sendMessage(ChannelInterceptorBase.java:76)
        at org.apache.catalina.tribes.group.ChannelInterceptorBase.sendMessage(ChannelInterceptorBase.java:76)
        at org.apache.catalina.tribes.group.interceptors.TestOrderInterceptor$MangleOrderInterceptor.sendMessage(TestOrderInterceptor.java:187)
        - locked Monitor@7ccb7255 at org.apache.catalina.tribes.group.interceptors.TestOrderInterceptor$MangleOrderInterceptor.sendMessage(TestOrderInterceptor.java:n/a) 
        at org.apache.catalina.tribes.group.interceptors.OrderInterceptor.sendMessage(OrderInterceptor.java:88)
        at org.apache.catalina.tribes.group.ChannelInterceptorBase.sendMessage(ChannelInterceptorBase.java:76)
        at org.apache.catalina.tribes.group.GroupChannel.send(GroupChannel.java:233)
        at org.apache.catalina.tribes.group.GroupChannel.send(GroupChannel.java:186)
        at org.apache.catalina.tribes.group.interceptors.TestOrderInterceptor$2.run(TestOrderInterceptor.java:111)
        - locked Monitor@7ccb7286 at org.apache.catalina.tribes.group.interceptors.TestOrderInterceptor$2.run(TestOrderInterceptor.java:110) 
    T47 is created by T1
        at org.apache.catalina.tribes.group.interceptors.TestOrderInterceptor.testOrder2(TestOrderInterceptor.java:124)

    Concurrent write in thread T37 (locks held: {})
 ---->  at org.apache.catalina.tribes.io.XByteBuffer.toBytes(XByteBuffer.java:478)
        at org.apache.catalina.tribes.membership.MemberImpl.getData(MemberImpl.java:204)
        at org.apache.catalina.tribes.membership.MemberImpl.getData(MemberImpl.java:170)
        at org.apache.catalina.tribes.membership.MemberImpl.getData(MemberImpl.java:164)
        at org.apache.catalina.tribes.membership.McastServiceImpl.send(McastServiceImpl.java:501)
        at org.apache.catalina.tribes.membership.McastServiceImpl.send(McastServiceImpl.java:487)
        at org.apache.catalina.tribes.membership.McastServiceImpl$SenderThread.run(McastServiceImpl.java:575)
    T37 is created by T31
        at org.apache.catalina.tribes.membership.McastServiceImpl.start(McastServiceImpl.java:280)
}}}

RV-Predict uses System.identityHashCode to identify distinct memory locations. When there is a hashcode collision, it could lead to false alarm. This occurs more often on race report which involves array element. I am not familiar with the code enough to check if this data array can shared between threads.
Comment 1 Yilong Li 2015-09-12 17:56:19 UTC
A similar one:
Data race on array element #14: {{{
    Concurrent read in thread T239 (locks held: {Monitor@7e1eac7f})
 ---->  at org.apache.catalina.tribes.io.XByteBuffer.append(XByteBuffer.java:228)
        at org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator$CoordinationMessage.write(NonBlockingCoordinator.java:738)
        at org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator.createData(NonBlockingCoordinator.java:281)
        at org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator.sendElectionMsg(NonBlockingCoordinator.java:260)
        at org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator.sendElectionMsgToNextInline(NonBlockingCoordinator.java:270)
        at org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator.handleOtherToken(NonBlockingCoordinator.java:365)
        at org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator.handleToken(NonBlockingCoordinator.java:331)
        at org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator.processCoordMessage(NonBlockingCoordinator.java:322)
        at org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator.messageReceived(NonBlockingCoordinator.java:498)
        at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:81)
        at org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageReceived(TcpFailureDetector.java:117)
        at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:81)
        at org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.messageReceived(DomainFilterInterceptor.java:48)
        at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:81)
        at org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:262)
        at org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:242)
        at org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:211)
        at org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:102)
        - locked Monitor@7e1eac7f at org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:n/a) 
    T239 is created by T177
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

    Concurrent write in thread T219 (locks held: {})
 ---->  at org.apache.catalina.tribes.io.XByteBuffer.toBytes(XByteBuffer.java:482)
        at org.apache.catalina.tribes.membership.MemberImpl.getData(MemberImpl.java:204)
        at org.apache.catalina.tribes.membership.MemberImpl.getData(MemberImpl.java:170)
        at org.apache.catalina.tribes.membership.MemberImpl.getData(MemberImpl.java:164)
        at org.apache.catalina.tribes.membership.McastServiceImpl.send(McastServiceImpl.java:501)
        at org.apache.catalina.tribes.membership.McastServiceImpl.send(McastServiceImpl.java:487)
        at org.apache.catalina.tribes.membership.McastServiceImpl$SenderThread.run(McastServiceImpl.java:575)
    T219 is created by T165
        at org.apache.catalina.tribes.membership.McastServiceImpl.start(McastServiceImpl.java:280)
}}}
Comment 2 Mark Thomas 2015-09-18 09:23:55 UTC
I think these are all duplicates of a previously fixed problem. I'm going to mrk this report as such but we can always re-open it if we find RV-Predict continues to report errors in this area.

*** This bug has been marked as a duplicate of bug 58395 ***