-
Bug
-
Resolution: Done
-
Major
-
1.1.8.Final, 2.0.0.Alpha2
-
None
The following beans will cause a deadlock between Weld AbstractContext session and application contexts creationLock if two requests in the same session are run, where the first one injects "SThing" and the other request injects "AThing".
The problem is that the first request locks the session scoped lock first and application scoped next, while the other request locks in the opposite order.
public class ApplicationToSessionProducer { @Inject Instance<AScoped> ascoped; @Produces @SessionScoped public SThing getThing() { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } ascoped.get().foo(); return new SThing(); } }
public class SessionToApplicationProducer { @Inject Instance<SScoped> sscoped; @Produces @ApplicationScoped public AThing getThing() { sscoped.get().foo(); return new AThing(); } }
where
@ApplicationScoped public class AScoped { public void foo() {} } @SessionScoped public class SScoped implements Serializable { public void foo() {} }