Details
-
Type: Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
We've uncovered a deadlock in Picocontainer 1.0. Attached is a test case that demonstrates it.
If your components only have dependencies on interfaces, who's implementations are registered with their interfaces as the key, then you will never get this deadlock.
The deadlock will only manifest if you register things in a "wacky" way (e.g. as in the test case, or by having components with multiple ctors some of which have unsatisfiable dependencies). In this case, the container will look at all ComponentAdapters to see if they can provide the implementation class. Two SynchronisedComponentAdapters doing this at the same time will result in a deadlock.
The fix is to not synchronise on the immutable state in SynchronisedComponentAdapter, see attached.
Activity
Field | Original Value | New Value |
---|---|---|
Attachment | PicoContainerDeadlockTest.java [ 12596 ] |
Attachment | SynchronizedComponentAdapter.java [ 12597 ] |
Assignee | Joerg Schaible [ joehni ] |
Status | Open [ 1 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] |
patch