Issue Type: Bug Bug
Affects Versions: 2.0.0.CR4, 1.2.0.Beta1, 1.1.12.Final
Assignee: Jozef Hartinger
Components: Scopes & Contexts
Created: 30/Apr/13 5:55 AM
Description:

org.jboss.weld.context.http.HttpSessionContextImpl is the multithreaded context. Also it uses these classes for internal BeanStore:
org.jboss.weld.context.beanstore.http.LazySessionBeanStore
org.jboss.weld.context.beanstore.http.EagerSessionBeanStore

Under the hood these BeanStore_s use HashMap as storage for beans (AbstractSessionBeanStore -> AttributeBeanStore.beanStore.delegate).

However implementation for retrieving bean from the context does not provide additional synchronization for read operation. See
org.jboss.weld.context.AbstractContext.get(Contextual<T>,CreationalContext<T>) line 90 - not synchronized reading from BeanStore (HashMap):
ContextualInstance<T> beanInstance = beanStore.get(id);

This can cause infinite loop because of concurrent modification for HashMap.

This problem does not affect other multithreaded Context impl in Weld (ApplicationContextImpl and SingletonContextImpl), because they use ConcurrentHashMapBeanStore with ConcurrentHashMap inside (see AbstractSharedContext.beanStore).

Environment: no specific
Project: Weld
Priority: Critical Critical
Reporter: Andrew Ryapolov
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira