[
https://jira.jboss.org/browse/GTNPORTAL-1545?page=com.atlassian.jira.plug...
]
Minh Hoang TO commented on GTNPORTAL-1545:
------------------------------------------
In fact, there is no deterministic steps to reproduce the 'infinite loop' as
HashMap is used in a multi-thread context.
In the latest patch, HashMap was replaced with ConcurrentHashMap, the last one takes
default values for initial capacity, load factor and concurrencyLevel
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
Assignee: Minh Hoang TO
Attachments: exception-stacktrace.txt, GTNPORTAL-1545-20101025.patch
Original Estimate: 6 hours
Remaining Estimate: 6 hours
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