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 160206

Summary: Deadlock in schema editor
Product: xml Reporter: Nikita Krjukov <supernikita>
Component: Schema ToolsAssignee: Samaresh Panda <samaresh>
Status: RESOLVED FIXED    
Severity: blocker CC: adrianriley, slunegov
Priority: P1    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Test XSD file. It has mistake intentionally
Thread dump

Description Nikita Krjukov 2009-03-12 19:25:28 UTC
A deadlock happens in Schema editor. NetBeans need to be restarted after it. 
Step to reproduce: 

1. Open the attached schema file. The Schema editor has to appear. The corresponding module has to be installed in
NetBeans. 
2. The schema editor should be opened on Schema tab. 
3. The XSD file is invalid. So the Schema tab contains warning: The schema in not well-formed. Please fix it in the
source view. 
4. Switch to the source view. 
5. The <xsd:redefine> element has incorrect closing tag. A slash has to be added at the end: </xsd:redefine> 
6. Add slash and the NetBeans hangs. If it isn't, try press save button. 

The problem is reproduced on NetBeans 6.5 on Windows and Solaris.
Comment 1 Nikita Krjukov 2009-03-12 19:27:35 UTC
Created attachment 78130 [details]
Test XSD file. It has mistake intentionally
Comment 2 Nikita Krjukov 2009-03-12 19:29:24 UTC
Created attachment 78131 [details]
Thread dump
Comment 3 Nikita Krjukov 2009-03-12 19:42:49 UTC
Preliminary analysis shows that the Schema model become valid and it starts notifying listeners. 
The notifications happens in the "Default RequestProcessor" thread: 

org.netbeans.modules.xml.schema.multiview.SchemaColumnViewMultiViewElement.recreateUI(SchemaColumnViewMultiViewElement.java:357)
org.netbeans.modules.xml.schema.multiview.SchemaColumnViewMultiViewElement.propertyChange(SchemaColumnViewMultiViewElement.java:226)

It seems the SchemaColumnViewMultiViewElement.recreateUI should be executed in AWT thread rather than in the "Default
RequestProcessor". It looks like it comes to blocking AWT thread. 

There is another strange finding. It is a kind of performance issue. The recreated UI element corresponds to Schema tab,
which is invisible. It can be initialized only when it is required. Otherwise editing of sources can come to frequent
processing behind the scene. 
Comment 4 Nikita Krjukov 2009-03-12 19:47:16 UTC
TODO: It's necessary to check the issue with a trunk build. It can be already fixed there. 
But it would be better to have it fixed in netbeans65_fixes anyway. 
Comment 5 Nikita Krjukov 2009-03-17 12:22:55 UTC
The issue #116057 looks very similar. It seems they both have common reason - execution of java WindowsAPI functions out
of event dispatch thread. Despite I can't reproduce it in trunk, I'm going to correct it everywhere. I bereave it's
important because the risk of deadlock is quite high. 
Comment 6 Nikita Krjukov 2009-03-18 12:05:18 UTC
The issue #116057 looks very similar. It seems they both have common reason - execution of java WindowsAPI functions out
of event dispatch thread. Despite I can't reproduce it in trunk, I'm going to correct it everywhere. I bereave it's
important because the risk of deadlock is quite high. 
Comment 7 Nikita Krjukov 2009-03-18 12:05:43 UTC
The issue #116057 looks very similar. It seems they both have common reason - execution of java WindowsAPI functions out
of event dispatch thread. Despite I can't reproduce it in trunk, I'm going to correct it everywhere. I bereave it's
important because the risk of deadlock is quite high. 
Comment 8 Nikita Krjukov 2009-03-18 12:10:23 UTC
I pushed changes to trunk: http://hg.netbeans.org/main/rev/851f66f426ad
The fix delegates processing of events from schema model to event dispatch thread in case the events come from another
thread. It is applied only for cases when event processing is done in favor of UI modification. It is required to do UI
modification in the event dispatch thread. 
Comment 9 Nikita Krjukov 2009-03-18 12:13:06 UTC
TODO: It maybe reasonable to check another XDM based models to vulnerability regarding the same reasons. For example
WSDL model. 
Comment 10 Nikita Krjukov 2009-03-18 13:24:37 UTC
I just tried reproduce the issue in the release65_fixes and failed. So I'm not sure if it worth to migrate the issue there. 
Comment 11 Quality Engineering 2009-03-19 20:39:42 UTC
Integrated into 'main-golden', will be available in build *200903191401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/851f66f426ad
User: supernikita@netbeans.org
Log: Fix the issue #160206 - Deadlock in schema editor
Comment 12 Nikita Krjukov 2009-03-20 18:59:51 UTC
*** Issue 159183 has been marked as a duplicate of this issue. ***
Comment 13 Nikita Krjukov 2009-05-04 18:41:42 UTC
*** Issue 162770 has been marked as a duplicate of this issue. ***
Comment 14 Svata Dedic 2011-10-18 12:42:09 UTC
*** Bug 162106 has been marked as a duplicate of this bug. ***