Concurreny problem - NullPointerException in BreadcumbsPortlet during performance test
--------------------------------------------------------------------------------------
Key: GTNPORTAL-1541
URL:
https://jira.jboss.org/browse/GTNPORTAL-1541
Project: GateIn Portal
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: WebUI
Affects Versions: 3.1.0-GA
Environment: GateIn trunk (revision 4282) on EAP5
Reporter: Marek Posolda
Sometimes during performance test, I am seeing NPE exception in server log, thrown from
UIBreadcumbsPortlet. Exception stacktrace is:
2010-10-06 09:11:15,589 ERROR
[org.exoplatform.webui.application.portlet.PortletApplicationController]
(http-127.0.0.1-8080-4) Error while rendering the porlet
java.lang.NullPointerException
at
org.exoplatform.portal.webui.component.UIBreadcumbsPortlet.loadSelectedPath(UIBreadcumbsPortlet.java:69)
at
org.exoplatform.portal.webui.component.UIBreadcumbsPortlet.renderChildren(UIBreadcumbsPortlet.java:89)
at
org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle.processRender(UIApplicationLifecycle.java:73)
at
org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle.processRender(UIApplicationLifecycle.java:31)
at org.exoplatform.webui.core.UIComponent.processRender(UIComponent.java:144)
at
org.exoplatform.webui.core.UIPortletApplication.processRender(UIPortletApplication.java:146)
at
org.exoplatform.webui.application.portlet.PortletApplication.render(PortletApplication.java:253)
at
org.exoplatform.webui.application.portlet.PortletApplicationController.render(PortletApplicationController.java:110)
at
org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl$Invoker.doFilter(PortletContainerImpl.java:569)
Whole test log is attached in related issue JBEPP-459 for completeness. It is not occuring
in every performance test but only sometimes, so concurreny issue came to my mind first.
I did more investigation and I founded that the cause of problem is in thread-unsafe call
of method "getUIComponentEventConfig" on class
"org.exoplatform.webui.config.Component".
Problem can be seen if client1 calls this method and eventsMap is null -> eventsMap is
going to initialize during this call.
But when client2 calls this method before initialization of map by client1 is finished,
then problem can happen because eventsMap is not fully initialized for client2 ->
client2 can't find ChangePageNode event -> listener
UIPageActionListener.ChangePageNodeActionListener is not called for client2 -> UIPortal
of client2 has unitialized variables selectedNode and selectedPath ->
NullPointerException is thrown for client2 during rendering of BreadcumbsPortlet, because
UIPortal.selectedPath is null.
Steps to reproduce (with usage of Eclispe IDE):
- Add breakpoint to class org.exoplatform.webui.config.Component to line 184 (after call
of eventMap = new HashMap<String, Event>() )
- Open browser1 and go to localhost:8080/portal/public/classic . Client will be stopped on
breakpoint
- Open browser2 and go to localhost:8080/portal/public/classic . This client is not seeing
ChangePageNode event and so NPE is thrown for him in UIBreadcumbsPortlet.
Note: Method getUIComponentEventConfig is called many times during single HTTP request. So
is it possible to fix this issue by other way that full initialization of this method?
Because it can have bad impact on performance. I wonder if it's possible to
initialize eventsMap in constructor of Component class (only suggestion)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira