Summary: | Concurrent issue of TagFileProcessor | ||
---|---|---|---|
Product: | Tomcat 7 | Reporter: | Sheldon Shao <xshao> |
Component: | Jasper | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | howeverking |
Priority: | P2 | ||
Version: | trunk | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Attachments: | Unsynchronized getting wrapper from RuntimeContext |
Comment on attachment 30871 [details] Unsynchronized getting wrapper from RuntimeContext >Index: java/org/apache/jasper/compiler/TagFileProcessor.java >=================================================================== >--- java/org/apache/jasper/compiler/TagFileProcessor.java (revision 1507186) >+++ java/org/apache/jasper/compiler/TagFileProcessor.java (working copy) >@@ -533,9 +533,11 @@ > > JspCompilationContext ctxt = compiler.getCompilationContext(); > JspRuntimeContext rctxt = ctxt.getRuntimeContext(); >- JspServletWrapper wrapper = rctxt.getWrapper(wrapperUri); >+ > > synchronized (rctxt) { >+ JspServletWrapper wrapper = rctxt.getWrapper(wrapperUri); >+ > if (wrapper == null) { > wrapper = new JspServletWrapper(ctxt.getServletContext(), ctxt > .getOptions(), tagFilePath, tagInfo, ctxt Thanks for the report. This has been fixed in 8.0.x (for 8.0.0-RC4 onwards) and 7.0.x (for 7.0.44 onwards). |
Created attachment 30871 [details] Unsynchronized getting wrapper from RuntimeContext The following code has concurrent issue. JspRuntimeContext rctxt = ctxt.getRuntimeContext(); JspServletWrapper wrapper = rctxt.getWrapper(wrapperUri); synchronized (rctxt) { if (wrapper == null) { .... It creates duplicated JspServletWrapper in this scenario, A.jsp --> C.tag B.jsp --> C.tag A.jsp and B.jsp are both compiling and come to the given lines. Two threads all get null from JspRuntimeContext(JspServletWrapper == null). So two instances of JspServletWrapper was created.