Scalability issue with ResourceFactoryImpl.createHandlerDependentResource
kelapure May 3, 2012 2:48 PMDear All,
During stress test of my application I see that all my webcontainer threads are stuck doing a RichFaces dynamic resource load operation. Why is this /ResourceFactoryImpl.createHandlerDependentResource called for each request ?
3XMTHREADINFO "WebContainer : 137" J9VMThread:0x0000000084484300, j9thread_t:0x00007F5A6C87E570, java/lang/Thread:0x00000000667E6198, state:CW, prio=5
3XMTHREADINFO3 Java callstack:
4XESTACKTRACE at java/lang/ClassLoader.loadClassHelper(ClassLoader.java:657(Compiled Code))
4XESTACKTRACE at java/lang/ClassLoader.loadClass(ClassLoader.java:644(Compiled Code))
4XESTACKTRACE at com/ibm/ws/bootstrap/ExtClassLoader.loadClass(ExtClassLoader.java:113(Compiled Code))
4XESTACKTRACE at java/lang/ClassLoader.loadClass(ClassLoader.java:627(Compiled Code))
4XESTACKTRACE at com/ibm/ws/classloader/ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62(Compiled Code))
4XESTACKTRACE at com/ibm/ws/classloader/ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58(Compiled Code))
4XESTACKTRACE at com/ibm/ws/classloader/CompoundClassLoader.loadClass(CompoundClassLoader.java:565(Compiled Code))
4XESTACKTRACE at java/lang/ClassLoader.loadClass(ClassLoader.java:627(Compiled Code))
4XESTACKTRACE at com/ibm/ws/classloader/CompoundClassLoader.loadClass(CompoundClassLoader.java:565(Compiled Code))
4XESTACKTRACE at java/lang/ClassLoader.loadClass(ClassLoader.java:627(Compiled Code))
4XESTACKTRACE at java/lang/Class.forNameImpl(Native Method)
4XESTACKTRACE at java/lang/Class.forName(Class.java:168(Compiled Code))
4XESTACKTRACE at org/richfaces/resource/ResourceFactoryImpl.createHandlerDependentResource(ResourceFactoryImpl.java:306(Compiled Code))
4XESTACKTRACE at org/richfaces/resource/ResourceFactoryImpl.createDynamicResource(ResourceFactoryImpl.java:468(Compiled Code))
4XESTACKTRACE at org/richfaces/resource/ResourceFactoryImpl.createResource(ResourceFactoryImpl.java:412(Compiled Code))
4XESTACKTRACE at org/richfaces/resource/ResourceHandlerImpl.createResource(ResourceHandlerImpl.java:263(Compiled Code))
4XESTACKTRACE at org/richfaces/resource/ResourceHandlerImpl.createResource(ResourceHandlerImpl.java:278(Compiled Code))
4XESTACKTRACE at org/apache/myfaces/renderkit/html/HtmlScriptRenderer.encodeEnd(HtmlScriptRenderer.java:197(Compiled Code))
4XESTACKTRACE at javax/faces/component/UIComponentBase.encodeEnd(UIComponentBase.java:535(Compiled Code))
4XESTACKTRACE at javax/faces/component/UIComponent.encodeAll(UIComponent.java:626(Compiled Code))
It looks like Richfaces code is repeatedly dynamically loading a JSF resource i.e. output of an h:outputScript tag. Usually this fetch and classloading of the resource should only occur once. There was most likely a problem during the loading of the resource which results in repeated calls to loading the resource which ultimately leads to the problem since loading a resource on each request does not scale.The exception stack traces and snippets below illustrates the issue.
The thread below acquires a lock on the classloader and locks out other threads
3LKMONOBJECT com/ibm/ws/classloader/CompoundClassLoader@0x0000000001A812C8: owner "WebContainer : 137" (0x0000000084484300), entry count 1
3LKWAITERQ Waiting to enter:
3LKWAITER "WebContainer : 12" (0x0000000083D3FC00)
3LKWAITER "WebContainer : 16" (0x0000000083CF7700)
3LKWAITER "WebContainer : 19" (0x0000000083D01900)
3LKWAITER "WebContainer : 23" (0x0000000083D99300)
3LKWAITER "WebContainer : 30" (0x0000000083E71200)
3LKWAITER "WebContainer : 54" (0x00000000841A6F00)
3LKWAITER "WebContainer : 61" (0x0000000084214D00)
3LKWAITER "WebContainer : 75" (0x000000008426C900)
3LKWAITER "WebContainer : 81" (0x000000008424D500)
3LKWAITER "WebContainer : 97" (0x000000008435E700)
3LKWAITER "WebContainer : 103" (0x0000000084363800)
3LKWAITER "WebContainer : 109" (0x00000000843C1500)
3LKWAITER "WebContainer : 121" (0x0000000084418100)
3LKWAITER "WebContainer : 124" (0x000000008441D200)
3LKWAITER "WebContainer : 147" (0x00000000844F9400)
3LKWAITER "WebContainer : 155" (0x000000008454A300)
3LKWAITER "WebContainer : 156" (0x000000008453D100)
3LKWAITER "WebContainer : 167" (0x00000000845AB500)
3LKWAITER "WebContainer : 175" (0x00000000845A9500)
3LKWAITER "WebContainer : 189" (0x0000000084664200)
3LKWAITER "WebContainer : 191" (0x000000008465B100)
3LKWAITER "WebContainer : 194" (0x0000000084691B00)
3LKWAITER "WebContainer : 220" (0x0000000084762E00)
3LKWAITER "WebContainer : 282" (0x0000000084954A00)
3LKWAITER "WebContainer : 294" (0x00000000848FEC00)
If this a known issue can someone please provide the JIRA link.
Appreciate your help,
Rohit Kelapure