Joerg
[EMAIL PROTECTED] wrote:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23486
[PATCH] Race condition in MountNode.invoke
Summary: [PATCH] Race condition in MountNode.invoke Product: Cocoon 2 Version: Current CVS 2.1 Platform: All OS/Version: All Status: NEW Severity: Minor Priority: Other Component: core AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED]
MountNode.invoke does an unsynchronized processors.get whilst another thread could do a processors.put inside MountNode.getProcessor. (The synchronized on getProcessor only provides protection for write/write race conditions.)
The time window is very small and only likely to occur for a high hit-rate on a site with many map:mount sub-sitemaps. (I haven't seen the bug in action, just came across it during source inspection chasing another problem.)
Nevertheless, here the patch:
diff -u -r1.5 MountNode.java
--- components/treeprocessor/sitemap/MountNode.java 2003/07/10 13:17:00 1.5
+++ components/treeprocessor/sitemap/MountNode.java 2003/09/29 15:32:28
@@ -106,10 +106,7 @@
Map objectModel = env.getObjectModel();
String resolvedSource = this.source.resolve(context, objectModel);
- TreeProcessor processor = (TreeProcessor)processors.get
(resolvedSource);
- if (processor == null) {
- processor = getProcessor(env, resolvedSource);
- }
+ TreeProcessor processor = getProcessor(env, resolvedSource);
String resolvedPrefix = this.prefix.resolve(context, objectModel);
