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.
1. Create newLoanApplication schema. 2. Switch to Design View. 3. Apply Design Pattern "Garden of Edem" or "Alami Slice" (one which creates new complex types). Result: after creating several complex types, IDE hangs up. Checked on WinXP, MACOSX and MacIntel. On Macs, it happens consistently, on WinXP - from time to time.
Visible problem.
Product Version: NetBeans IDE 6.0 Beta 1 (Build 200709111000) Java: 1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105 System: Linux version 2.6.20-16-generic running on i386; UTF-8; en_US (nb) I tried this on linux and the IDE never hangs but there are a lot of errors in the log file. I'm going to attach it. And yes, 100% of the time on Mac.
Created attachment 48674 [details] Log file from Ubuntu Linux
Sam has provided us with a patch that fixes the problem. Once that fix is checked into trunk we can verify and close this issue. Great work Sam!
Fix integrated: /cvs/xml/schema/abe/src/org/netbeans/modules/xml/schema/abe/AutoSizingPanel.java new revision: 1.5; previous revision: 1.4 /cvs/xml/schema/abe/src/org/netbeans/modules/xml/schema/abe/ModelEventMediator.java new revision: 1.7; previous revision: 1.6 /cvs/xml/schema/abe/src/org/netbeans/modules/xml/schema/abe/ElementPanel.java new revision: 1.7; previous revision: 1.6 /cvs/xml/schema/abe/src/org/netbeans/modules/xml/schema/abe/ContainerPanel.java new revision: 1.7; previous revision: 1.6
Did the changes make it into this build: NetBeans IDE Dev (Build 200709130000)? Because it is happening again. I'll attach a thread dump for you.
Created attachment 48766 [details] Thread dump from Mac when deadlock hit.
I have a feeling that the fix is somehow not in the build. In fact, it is very easy to verify. Apply the patch I gave you earlier on the build and see what happens.
I'm not sure what happened but the first time I installed NetBeans IDE Dev (Build 200709130000) I hit the deadlock first try that is why I reopened. I uninstalled the IDE deleted my usr dir and .nbi file reinstalled and now I cannot reproduce it. I tried that because I could not reproduce on Win XP or Linux so I knew the fixes were there.
Fix VERIFIED Product Version: NetBeans IDE Dev (Build 200709180000) Java: 1.5.0_07; Java HotSpot(TM) Client VM 1.5.0_07-87
I can reproduce it for RC1. WinXP, JDK1.6. Can't give a consistent scenario, but it seems that doing a refactoring operation (rename) and expanding "Elements" and "Cpmlex Types" nodes before applying design pattern increases chance of facing the problem.
It can be reproduced often after steps in 121758. But it happens in other cases also.
Looking into it.
Please apply the jar(copy to ide8/modules) and verify the fix. If it works, I'll request for integration in release60 branch.
Created attachment 52896 [details] axiom jar
Fixed in trunk. /cvs/xml/axi/src/org/netbeans/modules/xml/axi/impl/AXIModelImpl.java,v <-- AXIModelImpl.java new revision: 1.7; previous revision: 1.6
Please see the attached patch. The fix ensures that the needsSync() method is carried out by one thread at a time and this does not affect any other areas of the IDE.
Created attachment 52906 [details] patch
OK, I have tested some other areas and do not see any issues with the patch. I give a go ahead for integration into HR branch from my side.
[originally posted to patch review list] Perhaps I am ignorant, but this is the first time I have ever seen *more* synchronization solve a deadlock - it suggests that the original code was over- synchronized to begin with, and the solution is to create a bottleneck before whatever bottleneck caused the problem - so a real fix is to rethink the threading model for all the code having the problem. The fact that the method whose signature gets "synchronized" added to it is one called "needsSync" suggests that someone was trying to create a fast non- blocking test for whether or not something needs to be updated, and probably the fix will make it blocking and that will have side-effects elsewhere. So, do this if it is what is needed to to ship 6.0, but it smells bad and should be revisited after. I tried to review the patch but it is too minimal to know what will change.
I came to the same conclusion as Tim about the patch. I was not able to reproduce deadlock with my trunk build (without the fix). I suggest the best action is to reopen the bug and adjust the priority to P2 due to lack of reliable way to reproduce and the described test case seems (apply pattern -> rename -> undo...) - IMO, not a frequent usage of schema editing. The effort to fix should be directly derived from the deadlock analysis.
I'm able to reproduce the issue WITH the patch applied. Can't provide thread dump: by some reason, thread dump shortcut doesn't work.
We have discussed the issue. It seems that it happens rarely enough, and the fix may be risky and not exactly solves the problem. So, the best decision is to decrease bug priority to P2 and wait for more appropriate fix and more appropriate time to do it, and I'm doing so.
Tim, I agree with you. Yes, there is over-synchronization but is too risky to revisit the threading model in xam at this point. I'll revert my changes, since it doesn't really fix the problem, though I was given a go before. And I feel sorry for the mess.
Unable to reproduce in the current Netbeans 6.1 build on WinXP. Will try more.
Applying Garden of Eden pattern is OK, but if I try and apply another pattern after the transformation the IDE hangs. I'll attach the thread dump. It says there is a deadlock. Product Version: NetBeans IDE Dev (Build 200801170000) Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-119 System: Mac OS X version 10.5.1 running on i386; MacRoman; en_US (nb)
Created attachment 55216 [details] Thread dump from Mac after second transformation
Actually, sometimes the deadlock is hit when doing first transformation (to garden of Eden) on Mac.
I found that I hit the deadlock when I start the IDE from the command line. Specifically, if I first cd to <InstallDir>\bin then run netbeans the deadlock happens when applying design pattern in design view. However, if I run the IDE from the command line by .<Installdir>\bin\netbeans it doesn't happen.
Unfortunately, it turns out that the problem can be hit no matter what way you start the IDE, from command line or from launcher icon. Just some ways lead to hitting it easier than others.
System Info: Product Version: NetBeans IDE Dev (Build 200801220251) Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19 System: Linux version 2.6.22-14-generic running on i386; UTF-8; en_US (nb) Not able to reproduce on Linux. Looking more and more like a Mac only issue.
I'm unable to reproduce this on Windows, nor in Solaris. In any case, will try to make a patch for Mac.
Fix integrated: http://hg.netbeans.org/main?cmd=changeset;node=8d0ebd95c4d6.
Fix Verified Product Version: NetBeans IDE Dev (Build 200803191206) Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-119 System: Mac OS X version 10.5.2 running on i386; MacRoman; en_US (nb)