Issue Type: Bug Bug
Affects Versions: 1.1.8.Final, 2.0.0.Alpha2
Assignee: Marko Lukša
Attachments: helloworld.tar.gz, jboss-as-helloworld.war, jstack.txt
Components: Scopes & Contexts
Created: 10/Jul/12 10:07 AM
Description:

There is a deadlock between SFSB Synchronization lock and the Weld AbstractContext session context lock, which causes the SFSB and the session context to be locked until the SFSB lock timeouts with javax.ejb.ConcurrentAccessTimeoutException.

The situation can be caused by a producer inside a SFSB, such as:

@Stateful
@SessionScoped
public class StatefulProducer
{
   @Inject
   private Instance<OnDemandBean> onDemandBean;
   
   @Produces
   @SessionScoped
   public Thing getThing() {
      return new Thing();
   }
   
   public void demand() {
      Thread.sleep(2000);      
      onDemandBean.get().foo();
   }
}
@SessionScoped
public class OnDemandBean implements Serializable {
   public void foo() {}
}

The problem occurs when there are two requests in the same session, with the first one calling StatefulProducer.demand and the other request injecting the Thing. The first request locks the SFSB synchronization lock first and then the Weld AbstractContext lock during the "onDemandBean.get()" call. The second request locks the Weld AbstractContext lock first and the SFSB synchronization lock next (during the producer getThing() call)

Environment: JBoss AS 7.1.2.Final
Project: Weld
Priority: Major Major
Reporter: Marek Schmidt
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