Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 191471

Summary: Lookup ceases to find listeners
Product: platform Reporter: boreilly
Component: LookupAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED INVALID QA Contact: issues <issues.netbeans.org>
Priority: P3 Keywords: PLATFORM, THREAD
Version: 6.x   
Target Milestone: 7.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Issue Type: DEFECT Exception Report:
Attachments: Source code for small NB Platform app demonstrating defect
Shows the log file from a reproduced run

Description boreilly 2010-10-29 16:53:46 UTC
Created attachment 102711 [details]
Source code for small NB Platform app demonstrating defect

I'm experiencing a defect in my NetBeans Platform application whereby my Lookup objects fail to find their listeners after there has been a sufficient but modest number and frequency of Lookup invocations.  A SwingWorker thread passes data to the AWT thread via SwingUtilities.invokeLater and then the AWT thread invokes the Lookup API.  I have reproduced the problem in a smaller NetBeans Platform application called LookupProblem which I will attach.

Directions to reproduce:
	: Run the attached LookupProblem app from the NetBeans IDE.
	: Click the "Send set A messages" button.
	: Observe in the output window, or in the messages.log, the following output:
		INFO [org.netbeans.luprob.provider.ProviderTopComponent]: Provider's A button pressed. 
		INFO [org.netbeans.luprob.commsvc.CommUtil]: Start raiseMessageThreadSafely
		INFO [org.netbeans.luprob.commsvc.CommUtil]: End raiseMessageThreadSafely
		INFO [org.netbeans.luprob.commsvc.CommUtil]: Start raiseMessage
		INFO [org.netbeans.luprob.listener.ListenerTopComponent$LargeMsgListener]: Beginning of AbstractLookupListener.resultChanged for class:org.netbeans.luprob.commsvc.LargeMessage
		INFO [org.netbeans.luprob.listener.ListenerTopComponent$LargeMsgListener]: Listener received LargeMessage. Duration:63 pointlessString:4288012
		INFO [org.netbeans.luprob.listener.ListenerTopComponent$LargeMsgListener]: Beginning of AbstractLookupListener.resultChanged for class:org.netbeans.luprob.commsvc.LargeMessage
		INFO [org.netbeans.luprob.commsvc.CommUtil]: End raiseMessage
	: Click the “Send set B messages” button.
	: Observe in the output window, or in the messages.log, that the ListenerTopComponent does not process Lookups.:
		INFO [org.netbeans.luprob.provider.ProviderTopComponent]: Provider's B button pressed.
		INFO [org.netbeans.luprob.commsvc.CommUtil]: Start raiseMessageThreadSafely
		INFO [org.netbeans.luprob.commsvc.CommUtil]: End raiseMessageThreadSafely
		INFO [org.netbeans.luprob.commsvc.CommUtil]: Start raiseMessageThreadSafely
		INFO [org.netbeans.luprob.commsvc.CommUtil]: End raiseMessageThreadSafely
		[… previous pair occur a total of 10 times …]
		INFO [org.netbeans.luprob.commsvc.CommUtil]: Start raiseMessage
		INFO [org.netbeans.luprob.commsvc.CommUtil]: End raiseMessage
		INFO [org.netbeans.luprob.commsvc.CommUtil]: Start raiseMessage
		INFO [org.netbeans.luprob.commsvc.CommUtil]: End raiseMessage
		[… previous pair occur a total of 10 times …]

The attached messages.LookupProblem.log is from a run where I did these steps.  If you have difficulty reproducing, try increasing the number of messages or increasing the ListenerTopComponent's busyWork. 

This defect is critical to my application, so would appreciate feedback in the short term, including possible workarounds.
Comment 1 boreilly 2010-10-29 16:58:33 UTC
Created attachment 102712 [details]
Shows the log file from a reproduced run
Comment 2 boreilly 2010-10-30 02:41:42 UTC
I should be more explicit about the expected result.  "Set A" demonstrates the success of the Lookup, indicated by the ListenerTopComponent log statements.  Set B demonstrates failed Lookups, indicated by the absence of ListenerTopComponent log statements between "Start raiseMessage" and "End raiseMessage".
Comment 3 boreilly 2010-10-31 22:05:15 UTC
After downloading the lookup package source code and examining what's happening, I can see this defect is due to the ListenerTopComponent not maintaining a reference to the Listener and Result objects as it should.  Thus this is not a defect in the lookup package code.  Perhaps the Javadocs could use a blurb explaining the use of weak references in the lookup package, but that's the only change that might be necessary with this bug report, that I can see.
Comment 4 Jaroslav Tulach 2010-11-10 12:12:03 UTC
I thought it will be the weak reference problem. OK, I put a warning into javadoc core-main#eed728104f48. I am not sure whether I shall close the bug as fixed or invalid...
Comment 5 Quality Engineering 2010-11-11 06:08:50 UTC
Integrated into 'main-golden', will be available in build *201011110000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/eed728104f48
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #191471: Non-normative warning about GC problems
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