Bug 49987 - Data race in ApplicationContext
Data race in ApplicationContext
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Catalina
6.0.29
PC All
: P3 minor (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-09-23 10:16 UTC by Sergey Vorobyev
Modified: 2010-10-13 10:42 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.