Bug 49987

Summary: Data race in ApplicationContext
Product: Tomcat 6 Reporter: Sergey Vorobyev <sergeyvorobyev>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: minor CC: konstantin.s.serebryany, sergeyvorobyev
Priority: P3    
Version: 6.0.29   
Target Milestone: default   
Hardware: PC   
OS: All   

Description Sergey Vorobyev 2010-09-23 10:16:06 UTC
r998053
http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java

Data race on variable 
private Map parameters

In method

    private void mergeParameters() {

        if (parameters != null)  // concurrent read : 881
            return;
        Map results = new ConcurrentHashMap();
        ...
        parameters = results; // concurrent write : 897

    }
Comment 1 Tim Whittington 2010-09-30 03:45:45 UTC
The best way to fix this is probably to do the merge in the startup lifecycle (probably near the end of StandardContext.startInternal) and set the parameters into the ApplicationContext.
(ApplicationContext is constructed and used before local application parameters are added in the lifecycle)
Comment 2 Mark Thomas 2010-10-07 17:56:06 UTC
Fixed in trunk and will be included in 7.0.4 onwards.

Proposed for 6.0.x
Comment 3 Mark Thomas 2010-10-13 10:42:37 UTC
Fixed in 6.0.x and will be included in 6.0.30 onwards.