Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 237657 - Possible endless loop in WeakListenersImpl.ProxyListener<init>()
Possible endless loop in WeakListenersImpl.ProxyListener<init>()
Product: platform
Classification: Unclassified
Component: -- Other --
All All
: P2 (vote)
: 8.0
Assigned To: Jaroslav Tulach
Depends on:
  Show dependency treegraph
Reported: 2013-10-25 11:08 UTC by mklaehn
Modified: 2013-11-24 02:19 UTC (History)
0 users

See Also:
Issue Type: DEFECT

proposed patch (1009 bytes, application/octet-stream)
2013-10-25 11:08 UTC, mklaehn

Note You need to log in before you can comment on or make changes to this bug.
Description mklaehn 2013-10-25 11:08:52 UTC
Created attachment 141552 [details]
proposed patch

In the constructor of WeakListenersImpl.ProxyListener there is an unsynchronized access to a static WeakHashMap. WeakHashMap itself is not threadsafe and must be wrapped in a synchronized container to prevent data structure corruption. The corruption has the effect of a tight loop and thus blocks the Thread. Not a deadlock but bad nonetheless.
Multi-threaded calls to

public static <T extends EventListener> T create(Class<T> lType, Class<? super T> apiType, T l, Object source)

can lead to said corruption and block the caller Thread. The attached patch wraps the WeakHashMap in a synchronized Map and thus fixes this defect.
Comment 1 Jaroslav Tulach 2013-11-20 09:11:09 UTC
Comment 2 Quality Engineering 2013-11-24 02:19:28 UTC
Integrated into 'main-silver', will be available in build *201311240002* on (upload may still be in progress)

User: Martin Klaehn <>
Log: #237657: Synchronizing access to constructors map. Reviewed by, thanks for the patch.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo