You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2007/02/20 22:40:40 UTC

DO NOT REPLY [Bug 41661] New: - JspConfig.init() is not synchronized

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41661>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41661

           Summary: JspConfig.init() is not synchronized
           Product: Tomcat 5
           Version: 5.5.20
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: doug.hauge@lithium.com


The 'JspConfig.init()' method can be called simultaneously from multiple threads
at the same time, but it is not synchronized, so the initialization code in the
body can be executed simultaneously by multiple threads. This can lead to a
'jsp-property-group' configuration being added twice to the 'jspProperties'
vector. The symptom we noticed was that on some runs, the contents of the
'include-prelude' and 'include-coda' elements would be included twice in all
compiled jsp files.

This bug is hard to reproduce because it requires a run where the first thing
that happens is that multiple jsp files are requested simultaneously. However,
after adding a field containing a synchronization object and synchronizing on it
across the 

if (!initialized) {
...
}

block, we haven't seen the problem reoccur.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 41661] - JspConfig.init() is not synchronized

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41661>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41661





------- Additional Comments From doug.hauge@lithium.com  2007-02-20 13:44 -------
Created an attachment (id=19615)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=19615&action=view)
Patch that synchronizes initialization in 'JspConfig.init'


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 41661] - JspConfig.init() is not synchronized

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41661>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41661


doug.hauge@lithium.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Additional Comments From doug.hauge@lithium.com  2007-02-20 16:15 -------
For each page, compilation is synchronized, but it is not synchronized between
pages. This is typically not a problem because most of the state for different
pages isn't shared, but the 'JspConfig' instance is via the shared
'EmbeddedServletOptions' instance. 

Here is the top of the stack when 'JspConfig.init()' is first called:

JspConfig.init() line: 202	
JspConfig.findJspProperty(String) line: 254	
AntCompiler(Compiler).generateJava() line: 112	
AntCompiler(Compiler).compile(boolean, boolean) line: 295	
AntCompiler(Compiler).compile(boolean) line: 276	
AntCompiler(Compiler).compile() line: 264	
JspCompilationContext.compile() line: 563	
JspServletWrapper.service(HttpServletRequest, HttpServletResponse, boolean)
line: 305
JspServlet.serviceJspFile(HttpServletRequest, HttpServletResponse, String,
Throwable, boolean) line: 314	
JspServlet.service(HttpServletRequest, HttpServletResponse) line: 264	
JspServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 861	

The only synchronization that occurs in that stack is in
'JspServletWrapper.service', which synchronizes on 'this'. Each page has a
separate 'JspServletWrapper' instance, but all instances share a common
'EmbeddedServletOptions', which contains the 'JspConfig'. Thus, the
synchronization does not protect against multiple pages being compiled
simultaneously and calling 'init()' on the same 'JspConfig' instance at the same
time.



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 41661] - JspConfig.init() is not synchronized

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41661>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41661


remm@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From remm@apache.org  2007-02-20 14:05 -------
No, this additional sync will not be added. The recompilation checks should be
sufficiently synchronized already.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org