Fix thread-safety issue when parsing multiple web.xml files in parallel. Apache Tomcat does not do this but products that embed it may.
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@
1133446 13f79535-47bb-0310-9956-
ffa450edef68
// thread safe. Whilst there should only be one thread at a time
// processing a config, play safe and sync.
Digester digester;
+ WebRuleSet ruleSet;
if (fragment) {
digester = webFragmentDigester;
+ ruleSet = webFragmentRuleSet;
} else {
digester = webDigester;
+ ruleSet = webRuleSet;
}
- synchronized(digester) {
+ // Sync on the ruleSet since the same ruleSet is shared across all four
+ // digesters
+ synchronized(ruleSet) {
digester.push(dest);
digester.setErrorHandler(handler);
ok = false;
} finally {
digester.reset();
- if (fragment) {
- webFragmentRuleSet.recycle();
- } else {
- webRuleSet.recycle();
- }
+ ruleSet.recycle();
}
}
}
Avoid possible NPE when logging requests received during embedded Tomcat
shutdown. (markt)
</fix>
+ <fix>
+ <bug>51340</bug>: Fix thread-safety issue when parsing multiple web.xml
+ files in parallel. Apache Tomcat does not do this but products that
+ embed it may. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">