Bug 58392

Summary: Data race on field org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.membership
Product: Tomcat 8 Reporter: Yilong Li <yilong.li>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.0.x-trunk   
Target Milestone: ----   
Hardware: PC   
OS: Linux   

Description Yilong Li 2015-09-12 16:50:39 UTC
Reported by RV-Predict (a dynamic race detector) when running the test suite:
Data race on field org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.membership: {{{
    Concurrent read in thread T49 (locks held: {})
 ---->  at org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.memberAdded(DomainFilterInterceptor.java:58)
        at org.apache.catalina.tribes.group.ChannelInterceptorBase.memberAdded(ChannelInterceptorBase.java:87)
        at org.apache.catalina.tribes.group.ChannelCoordinator.memberAdded(ChannelCoordinator.java:245)
        at org.apache.catalina.tribes.membership.McastService.memberAdded(McastService.java:461)
        at org.apache.catalina.tribes.membership.McastServiceImpl$2.run(McastServiceImpl.java:397)
    T49 is created by T35
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

    Concurrent write in thread T48 (locks held: {Monitor@58bf36a2})
 ---->  at org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.setupMembership(DomainFilterInterceptor.java:108)
        - locked Monitor@58bf36a2 at org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.setupMembership(DomainFilterInterceptor.java:n/a)
        at org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.memberAdded(DomainFilterInterceptor.java:58)
        at org.apache.catalina.tribes.group.ChannelInterceptorBase.memberAdded(ChannelInterceptorBase.java:87)
        at org.apache.catalina.tribes.group.ChannelCoordinator.memberAdded(ChannelCoordinator.java:245)
        at org.apache.catalina.tribes.membership.McastService.memberAdded(McastService.java:461)
        at org.apache.catalina.tribes.membership.McastServiceImpl$2.run(McastServiceImpl.java:397)
    T48 is created by T35
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)
}}} 

Data race on field org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.membership: {{{
    Concurrent read in thread T49 (locks held: {})
 ---->  at org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.memberAdded(DomainFilterInterceptor.java:60)
        at org.apache.catalina.tribes.group.ChannelInterceptorBase.memberAdded(ChannelInterceptorBase.java:87)
        at org.apache.catalina.tribes.group.ChannelCoordinator.memberAdded(ChannelCoordinator.java:245)
        at org.apache.catalina.tribes.membership.McastService.memberAdded(McastService.java:461)
        at org.apache.catalina.tribes.membership.McastServiceImpl$2.run(McastServiceImpl.java:397)
    T49 is created by T35
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)

    Concurrent write in thread T48 (locks held: {Monitor@58bf36a2})
 ---->  at org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.setupMembership(DomainFilterInterceptor.java:108)
        - locked Monitor@58bf36a2 at org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.setupMembership(DomainFilterInterceptor.java:n/a)
        at org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor.memberAdded(DomainFilterInterceptor.java:58)
        at org.apache.catalina.tribes.group.ChannelInterceptorBase.memberAdded(ChannelInterceptorBase.java:87)
        at org.apache.catalina.tribes.group.ChannelCoordinator.memberAdded(ChannelCoordinator.java:245)
        at org.apache.catalina.tribes.membership.McastService.memberAdded(McastService.java:461)
        at org.apache.catalina.tribes.membership.McastServiceImpl$2.run(McastServiceImpl.java:397)
    T48 is created by T35
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1010)
}}}

Non-thread-safe implementation of lazy initialization.
Comment 1 Mark Thomas 2015-09-17 09:29:16 UTC
Fixed in trunk and 8.0.x for 8.0.27 onwards.