[JBoss JIRA] Created: (GTNPORTAL-1545) Concurrency problem (HashMap used in class ConfigurationManager in multithreaded environment)
by Marek Posolda (JIRA)
Concurrency problem (HashMap used in class ConfigurationManager in multithreaded environment)
---------------------------------------------------------------------------------------------
Key: GTNPORTAL-1545
URL: https://jira.jboss.org/browse/GTNPORTAL-1545
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
Attachments: exception-stacktrace.txt
Sometimes I can see exception during startup of performance. Exception is something like:
java.lang.reflect.InvocationTargetException: ...
Caused by: java.lang.Exception: Cannot find the configuration for the component org.exoplatform.portal.webui.container.UIContainerList, configId null
at org.exoplatform.webui.application.WebuiApplication.createUIComponent(WebuiApplication.java:110)
at org.exoplatform.webui.core.UIContainer.addChild(UIContainer.java:197)
at org.exoplatform.portal.webui.portal.UIPortalComposer.<init>(UIPortalComposer.java:97)
... 71 more
Whole stacktrace is attached. I am not seeing it in every test run, only sometimes. And usually the component is different in each case (sometimes it fails with different component that UIContainerList).
After investigation, I founded that problem is in class org.exoplatform.webui.application.ConfigurationManager which is shared by more clients (threads) but it's using HashMap "configs_". This piece of code in ConfigurationManager.getComponentConfig(Class<?> type, String id)
//
Component config = configs_.get(key);
if (config != null)
{
return config;
}
//
process(type);
//
return configs_.get(key);
is read component configuration (in case that this configuration is missing in map) and then it saves into HashMap and returns it. But in multithreaded environment, sometimes can still happen that this method returns null because "config_" HashMap is not thread-safe -> Exception is thrown in WebuiApplication.createUIComponent(WebuiApplication.java:110).
See this article http://java.dzone.com/articles/concurrency-and-hashmap with nice simple example, which is doing very similar scenario as ConfigurationManager.
--
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
15 years, 5 months
[JBoss JIRA] Created: (GTNPORTAL-1345) Avoid NPE when a portal container has been disabled
by Nicolas Filotto (JIRA)
Avoid NPE when a portal container has been disabled
---------------------------------------------------
Key: GTNPORTAL-1345
URL: https://jira.jboss.org/browse/GTNPORTAL-1345
Project: GateIn Portal
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Reporter: Nicolas Filotto
Thanks to EXOJCR-842, it is possible to avoid creating a given portal container if it has not been registered. However this has for consequences that we get some NPE (due to the fact that the container is null) in the portal since up to now GateIn doesn't allow to disable a portal.
The steps to reproduce are the following
1. Use exo.kernel.container-2.2.3-GA (or build the snapshot version if it is not yet released), in order to have the benefit of the feature EXOJCR-842
2. Remove the portal container definition of sample-portal from gatein-sample-portal.ear/exo.portal.sample.portal.config-3.0.0-GA.jar/conf/configuration.xml, in order to avoid registering the sample-portal
3. Start JBoss
4. Ensure that only the portal container "portal" has been launched
5. Stop JBoss, you should get the following exception:
Cannot broadcast the event 'org.exoplatform.web.GenericHttpListener.contextDestroyed'
java.lang.NullPointerException
at org.exoplatform.web.GenericHttpListener.broadcast(GenericHttpListener.java:216)
at org.exoplatform.web.GenericHttpListener.contextDestroyed(GenericHttpListener.java:143)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3882)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4516)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:924)
at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1189)
at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1160)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:313)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1086)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
at org.apache.catalina.core.StandardService.stop(StandardService.java:584)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:628)
at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:671)
7 juil. 2010 07:56:26 org.apache.coyote.http11.Http11Protocol destroy
--
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
15 years, 5 months