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 147290

Summary: IDE halted while "Opening Main Window..."
Product: editor Reporter: exlons <exlons>
Component: -- Other --Assignee: Vitezslav Stejskal <vstejskal>
Status: RESOLVED DUPLICATE    
Severity: blocker CC: tor
Priority: P2 Keywords: RANDOM, THREAD
Version: 6.x   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: thread dump file.

Description exlons 2008-09-15 17:06:39 UTC
after I tried to add a new code template, for taking the new setting into effect, I tried restart the IDE, then it
halted at "Opening Main Window...", I have to kill the halted process through windows process manager, and tried to
restart it again, it just halted again... until I delete the 'Windows2Local' dir manually under the config directory.
Comment 1 Peter Pis 2008-09-15 17:13:51 UTC
Could you please attach thread dump?

http://wiki.netbeans.org/GenerateThreadDump
Comment 2 exlons 2008-09-16 16:36:07 UTC
Created attachment 69961 [details]
thread dump file.
Comment 3 Peter Pis 2008-09-16 22:04:50 UTC
Reassigning to editor for evaluation.
Comment 4 Dusan Balek 2008-09-17 09:03:25 UTC
Reassigning to gsf.
Comment 5 Torbjorn Norbye 2008-09-22 05:19:47 UTC
Vita, any ideas?

It looks from the thread dump like the problem is that the EditorRegistry is being accessed from multiple threads
simultaneously. I'm not sure what it would be blocking on... perhaps the static initialization block?  

Is there a way for me to fix this? I've always assumed the EditorRegistry could be accessed from any thread (I've
replaced old code calling getOpenedPanes on editor cookies (which only worked on the event dispatch thread) with calls
to EditorRegistry.lastFocusedComponent()).

Would it be best to add a EditorRegistry call from my ModuleInstall perhaps to make sure it's initialized without
contest the first time?  Of course, that's going to trip off the startup-class-whitelist alarm...

I suppose I could synchronize on something in my module - but I also see a call into EditorRegistry from the java.source
thread as well so the potential for conflict is still there...  

I'm reassigning this to the editor library for further evaluation; if I'm doing something wrong please assign it back
and apologies in advance.
Comment 6 Miloslav Metelka 2008-09-22 10:23:48 UTC
IMHO the best solution will be ER will fire outside of a lock. I will attempt to fix it in this way.
Comment 7 Vitezslav Stejskal 2008-09-22 11:25:31 UTC
I'm pretty sure I fixed this already some time ago. I'm trying to find the original issue to make this a duplicate. Tor,
you are right, the problem is in ER and it really blocks on the static initialization (ie. the classloading and ER locks
clash). Mila, ER no longer fires events when holding its own lock.

exlons, could you please try newer build (eg the latest daily (dev) build)? Thanks
Comment 8 Vitezslav Stejskal 2008-09-22 11:28:02 UTC

*** This issue has been marked as a duplicate of 146336 ***
Comment 9 exlons 2008-09-22 18:51:35 UTC
I tried the latest build, the issue seems already gone, thanks.