You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by bu...@apache.org on 2003/11/05 10:31:35 UTC

DO NOT REPLY [Bug 24425] New: - race condition in class enhancement

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

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24425

race condition in class enhancement

           Summary: race condition in class enhancement
           Product: Tapestry
           Version: 3.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Framework
        AssignedTo: tapestry-dev@jakarta.apache.org
        ReportedBy: Michael.Frericks@sparkassen-informatik.de


1. Error description:

we got randomly ApplicationRuntimeExceptions of the kind

org.apache.tapestry.ApplicationRuntimeException 
Unable to define class org.apache.tapestry.components.Insert$Enhance_44: 
org/apache/tapestry/components/Insert$Enhance_44 (Repeative method 
name/signature) 

(full stack trace below)


2. Brief description of the application:

a) Tapestry Release: latest from repository
b) Application server: IBM WebSphere 4
c) Frameset based
d) Applet in invisible frames reload frames triggered by the application server


3. What is known about the circumstances under that this error arises?

a) the error occurs more often in that frames that are often and concurrently 
reloaded
   ("doubleclicking" invoked by applet) 
b) In case of a frame showing the error page a simple right-button-reload 
repairs that frame
c) But even in user driven page requesting the error occurs sometimes


4. What is supposed about the involved code?

a) The only reason seems to be that in BaseEnhancedClass the method addEnhancer
(enhancer)
   is called twice for on and the same "parameter" or "property"
b) Since the ComponentClassFactory generates the unique name: 
   startClassName + "$Enhance_" + _uid++;
   we know that after that point 4.a) happens

Conclusion

a) there is a race condition that lets two threads work on one instance of
   of IEnhancedClass for 'startClassName + "$Enhance_" + _uid++' 
b) i suppose that synchronizing the access to _enhancedClass in the class
   ComponentClassFactory solves this problem




Stacktrace:

An exception has occurred. 
You may continue by restarting the session. 

org.apache.tapestry.ApplicationRuntimeException 
Unable to define class org.apache.tapestry.components.Insert$Enhance_44: 
org/apache/tapestry/components/Insert$Enhance_44 (Repeative method 
name/signature) 
   
java.lang.ClassFormatError 
org/apache/tapestry/components/Insert$Enhance_44 (Repeative method 
name/signature) 
Stack Trace: 
java.lang.ClassLoader.defineClass0(Native Method) 
java.lang.ClassLoader.defineClass(ClassLoader.java(Compiled Code)) 
java.lang.ClassLoader.defineClass(ClassLoader.java:625) 
org.apache.tapestry.enhance.EnhancedClassLoader.defineClass
(EnhancedClassLoader.java:90) 
org.apache.tapestry.enhance.javassist.EnhancedClass.createEnhancedSubclass
(EnhancedClass.java:165) 
org.apache.tapestry.enhance.ComponentClassFactory.createEnhancedSubclass
(ComponentClassFactory.java:333) 
org.apache.tapestry.enhance.DefaultComponentClassEnhancer.constructComponentClas
s(DefaultComponentClassEnhancer.java:168) 
org.apache.tapestry.enhance.DefaultComponentClassEnhancer.getEnhancedClass
(DefaultComponentClassEnhancer.java:124) 
org.apache.tapestry.pageload.PageLoader.instantiateComponent
(PageLoader.java:650) 
org.apache.tapestry.pageload.PageLoader.createImplicitComponent
(PageLoader.java:616) 
org.apache.tapestry.BaseComponentTemplateLoader.createImplicitComponent
(BaseComponentTemplateLoader.java:316) 
org.apache.tapestry.BaseComponentTemplateLoader.process
(BaseComponentTemplateLoader.java:278) 
org.apache.tapestry.BaseComponentTemplateLoader.process
(BaseComponentTemplateLoader.java:215) 
org.apache.tapestry.BaseComponent.readTemplate(BaseComponent.java:141) 
org.apache.tapestry.BaseComponent.finishLoad(BaseComponent.java:176) 
org.apache.tapestry.pageload.PageLoader.constructComponent(PageLoader.java:566) 
org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:806) 
org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:194) 
org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:236) 
org.apache.tapestry.engine.PageService.service(PageService.java:114)

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