This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 237657

Summary: Possible endless loop in WeakListenersImpl.ProxyListener<init>()
Product: platform Reporter: mklaehn <mklaehn>
Component: -- Other --Assignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 7.4   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: proposed patch

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
ergonomics#e50988801ab5
Comment 2 Quality Engineering 2013-11-24 02:19:28 UTC
Integrated into 'main-silver', will be available in build *201311240002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e50988801ab5
User: Martin Klaehn <mklaehn@netbeans.org>
Log: #237657: Synchronizing access to constructors map. Reviewed by jtulach@netbeans.org, thanks for the patch.