On Tue, 24 Jan 2023 03:15:50 GMT, Sergey Bylokhov <[email protected]> wrote:
> Two methods in the BeanContextSupport class use two locks in a different > order, which can cause a deadlock. > > Here is the first order: (1) first acquire BeanContext.globalHierarchyLock > and then children: > > enter public method remove(Object) at line 484 > call remove(Object, boolean) at line 485 > acquire synchronization on BeanContext.globalHierarchyLock at line 502 > acquire synchronization on children at line 534 > > Here is the second order: (2) first acquire children and then > BeanContext.globalHierarchyLock: > > enter public method propertyChange() at line 1110 > acquire synchronization on children at line 1114 > call remove(Object, boolean) at line 1121 > acquire synchronization on BeanContext.globalHierarchyLock at line 502 > > The fix added the "BeanContext.globalHierarchyLock" before the usage of the > "children" lock in the propertyChange method. This pull request has now been integrated. Changeset: d4e9f5e5 Author: Sergey Bylokhov <[email protected]> URL: https://git.openjdk.org/jdk/commit/d4e9f5e5f2c92964c3602f34a59b92947d1595a5 Stats: 158 lines in 3 files changed: 147 ins; 0 del; 11 mod 8238170: BeanContextSupport remove and propertyChange can deadlock Reviewed-by: phh ------------- PR: https://git.openjdk.org/jdk/pull/12158
