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 199820 - 10 sec freezing while hyperlink to non UTF-8 include files
Summary: 10 sec freezing while hyperlink to non UTF-8 include files
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.0.1
Hardware: All All
: P2 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2011-07-01 12:54 UTC by dnikitin
Modified: 2011-09-27 12:12 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
stack0 (24.06 KB, text/plain)
2011-07-01 12:54 UTC, dnikitin
Details
stack1 (24.04 KB, text/plain)
2011-07-01 12:55 UTC, dnikitin
Details
stack3 (22.99 KB, text/plain)
2011-07-01 12:56 UTC, dnikitin
Details
stack4 (23.00 KB, text/plain)
2011-07-01 12:56 UTC, dnikitin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dnikitin 2011-07-01 12:54:49 UTC
Created attachment 109186 [details]
stack0

Product Version: NetBeans IDE 7.0.1 RC1 (Build cnd-build-5664-on-20110630)
Java: 1.6.0_23; Java HotSpot(TM) 64-Bit Server VM 19.0-b09
System: Linux version 2.6.32-21-generic running on amd64; UTF-8; en_US (nb)
--------------------------------------------------------------

* create Welcome
* add vvv-qa as remote host
* hyperlink (Ctrl+click) to iostream, then to ostream 

IDE freezes for 10-15 sec until a remote include is opened

see also IZ199730
Comment 1 dnikitin 2011-07-01 12:55:34 UTC
Created attachment 109187 [details]
stack1
Comment 2 dnikitin 2011-07-01 12:56:00 UTC
Created attachment 109188 [details]
stack3
Comment 3 dnikitin 2011-07-01 12:56:45 UTC
Created attachment 109189 [details]
stack4
Comment 4 Alexander Simon 2011-07-01 13:23:36 UTC
All stacks show GC activity in 8 threads.
Provide more information about memory.
If IDE is provided sufficient memory, take a memory snapshot.
Comment 5 dnikitin 2011-07-01 14:27:35 UTC
I hope it helps
/home/dn156283/Snapshots/Main-2011-07-01-1.snapshot
Comment 6 Vladimir Voskresensky 2011-07-02 02:50:11 UTC
Editor team, could you, please, help to understand why there could be 10 sec delay? Threads are in CloneableEditor$DoInitialize.initDocument(CloneableEditor.java:681):
"AWT-EventQueue-1" prio=10 tid=0x0000000041a05800 nid=0x417d in Object.wait() [0x00007f39fb6c3000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x00000000f1631ec0> (a org.openide.text.CloneableEditor$DoInitialize)
	at java.lang.Object.wait(Object.java:485)
	at org.openide.text.CloneableEditor$DoInitialize.initDocument(CloneableEditor.java:681)
	- locked <0x00000000f1631ec0> (a org.openide.text.CloneableEditor$DoInitialize)
	at org.openide.text.CloneableEditor$DoInitialize.initVisual(CloneableEditor.java:719)
	at org.openide.text.CloneableEditor.getEditorPane(CloneableEditor.java:1232)
	at org.openide.text.CloneableEditorSupport.getOpenedPanes(CloneableEditorSupport.java:1132)
	at org.netbeans.modules.cnd.modelutil.CsmUtilities$3$PropertyChangeListenerImpl.run(CsmUtilities.java:818)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:148)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


"org.openide.text Editor Initialization" daemon prio=10 tid=0x00000000417e5800 nid=0x4331 in Object.wait() [0x00007f39faebf000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x00000000f4e1cd10> (a org.openide.text.CloneableEditor$DoInitialize$1Query)
	at org.openide.text.CloneableEditor$DoInitialize$1Query.awaitAWT(CloneableEditor.java:451)
	- locked <0x00000000f4e1cd10> (a org.openide.text.CloneableEditor$DoInitialize$1Query)
	at org.openide.text.CloneableEditor$DoInitialize.initNonVisual(CloneableEditor.java:498)
	at org.openide.text.CloneableEditor$DoInitialize.run(CloneableEditor.java:332)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1424)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1968)
Comment 7 David Strupl 2011-07-02 09:27:01 UTC
I am sorry but this is a question for Jarda who put there the 10s wait ...
Comment 8 Jan Lahoda 2011-07-04 20:42:10 UTC
My understanding is that the 10s is not a wait, its a timeout to recover from deadlock.

What happens, IMO:
1. a file is being opened on background, that means the AWT is processing events
2. CsmUtilities$3$PropertyChangeListenerImpl.run as some time calls CloneableEditorSupport.getOpenedPanes, which needs to wait until the file is opened
3. in the background thread, a UserQuestionException occurs, so a dialog needs to be shown to the user. But, it is not possible to show the dialog because the AWT thread waits until getOpenedPanes finishes. Which needs to UQE to be resolved=>deadlock.
4. when the "emergency" 10s timeout passes, the UQE is unconditionally confirmed, so that the opening of the file may continue

I do not know why CsmUtilities$3$PropertyChangeListenerImpl.run needs to call CloneableEditorSupport.getOpenedPanes, but it will most likely need to stop doing that and use something like NbDocument.findRecentEditorPane, which should not block.

A side note: calling CloneableEditorSupport.getOpenedPanes is to my knowledge almost always wrong since the background file opening was implemented. I think it should have been deprecated and a big warning added to it when NbDocument.fREP was added.
Comment 9 Vladimir Voskresensky 2011-07-05 07:59:16 UTC
Jan, thanks for the investigation. Probably you are right. Let's try to fix on our side
Comment 10 Vladimir Voskresensky 2011-07-05 08:05:46 UTC
Other question: is it correct that PROP_OPENED_PANES is fired for async loaded editors before document is loaded?
If user answers "No" to UQE => event shouldn't be fired, right?
Comment 11 Vladimir Kvashin 2011-07-05 08:50:15 UTC
Jan, thank you for investigation.
BTW I just checked - CloneableEditorSupport.getOpenedPanes is not deprecated.
Comment 12 Vladimir Voskresensky 2011-07-13 14:24:46 UTC
I have the same issue on local Ubuntu
Comment 13 Alexander Pepin 2011-07-13 14:33:06 UTC
I can see that on any remote project.
Comment 14 Vladimir Voskresensky 2011-07-13 16:14:21 UTC
It happens when #include file is not in UTF-8, so question dialog should be opened, but awt is busy, so wait for 10 sec
Comment 15 Vladimir Voskresensky 2011-09-09 10:07:53 UTC
fixed:
http://hg.netbeans.org/cnd-main/rev/f915e4d5538a
Comment 16 Quality Engineering 2011-09-10 14:28:15 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/f915e4d5538a
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixed #199820  -  10 sec freezing while hyperlink to non UTF-8 include files
- use findRecentEditorPane method which does not hold AWT lock instead of getOpenedPanes
Comment 17 Alexander Simon 2011-09-12 16:06:14 UTC
Fix is safe and fixes the issue.
Comment 18 Vladimir Kvashin 2011-09-12 18:05:08 UTC
Integrated into releases_elif:
http://elif.russia.sun.com/hg/releases_elif/rev/6bb7e05fe609
Comment 19 Alexander Pepin 2011-09-19 14:55:19 UTC
verified in OSS build 30
Comment 20 Quality Engineering 2011-09-26 13:28:13 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/6bb7e05fe609
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixed #199820  -  10 sec freezing while hyperlink to non UTF-8 include files
- use findRecentEditorPane method which does not hold AWT lock instead of getOpenedPanes
(transplanted from f915e4d5538a1816c5e748d1667d97d151a2365e)
Comment 21 Alexander Pepin 2011-09-27 12:12:21 UTC
verified in OSS dev build based on 7.0.1 patch2