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 81266 - StackOverflowError on applying Russian Doll to OTA schema
Summary: StackOverflowError on applying Russian Doll to OTA schema
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Schema Tools (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P1 blocker (vote)
Assignee: Ayub Khan
URL:
Keywords:
: 80711 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-07-27 15:21 UTC by Andrei Chistiakov
Modified: 2006-08-25 13:48 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
OTA Schema (109.38 KB, application/octet-stream)
2006-07-28 11:57 UTC, Andrei Chistiakov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Chistiakov 2006-07-27 15:21:43 UTC
Reproduced in build 060726.

Applying Venetian Blind pattern to OTA schema results in:

java.lang.IllegalStateException: Referencing component is not part of model.
	at
org.netbeans.modules.xml.xam.dom.AbstractNamedComponentReference.checkParentPartOfModel(AbstractNamedComponentReference.java:173)
	at
org.netbeans.modules.xml.xam.dom.AbstractNamedComponentReference.getReferenced(AbstractNamedComponentReference.java:124)
	at
org.netbeans.modules.xml.schema.model.impl.GlobalReferenceImpl.get(GlobalReferenceImpl.java:65)
	at
org.netbeans.modules.xml.schema.model.impl.GlobalReferenceImpl.get(GlobalReferenceImpl.java:39)
	at org.netbeans.modules.xml.axi.impl.Util.getGlobalComplexType(Util.java:1449)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.createPeerGlobalComplexType(DefaultSchemaGenerator.java:415)
	at
org.netbeans.modules.xml.axi.impl.GardenOfEden.createPeerParent(GardenOfEden.java:163)
	at
org.netbeans.modules.xml.axi.impl.VenetianBlind.createPeerParent(VenetianBlind.java:81)
	at org.netbeans.modules.xml.axi.impl.GardenOfEden.visit(GardenOfEden.java:102)
	at org.netbeans.modules.xml.axi.Attribute.accept(Attribute.java:70)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:189)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformChildren(DefaultSchemaGenerator.java:194)
	at
org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformSchema(DefaultSchemaGenerator.java:130)
	at
org.netbeans.modules.xml.axi.impl.SchemaGeneratorFactoryImpl.transformSchema(SchemaGeneratorFactoryImpl.java:101)
	at
org.netbeans.modules.xml.schema.abe.wizard.SchemaTransformWizard$1.run(SchemaTransformWizard.java:115)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:499)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:932)
Comment 1 Ayub Khan 2006-07-28 11:44:23 UTC
Is this the flattend OTA schema, ie all the OTA files combined into one single
schema. If not can you specify which OTA schema file.
Comment 2 Andrei Chistiakov 2006-07-28 11:57:47 UTC
Created attachment 32291 [details]
OTA Schema
Comment 3 Andrei Chistiakov 2006-07-28 11:58:44 UTC
Yes, it's a singe file schema. Please find it in attachment.
Comment 4 Ayub Khan 2006-07-28 18:58:14 UTC
I do not see this exception. However after 30 minutes (even with 1GB of max
setting for JVM memory). I am getting StackOverFlow. It looks like we are firing
a lot of events for the XAM to handle, since we are mutating the schema model
incrementally (for descendents) of new global element's that are added. I am
going to try a different approach of creating global elements outside of the
schema model and then adding them. This reduces the events drastically. If
approach also does not work, we may want to fix this for FCS.

java.lang.reflect.UndeclaredThrowableException
        at $Proxy15.childrenAdded(Unknown Source)
        at org.netbeans.modules.xml.xam.ComponentEvent$EventType$2.fireEvent(Com
ponentEvent.java:59)
        at org.netbeans.modules.xml.xam.AbstractModel$Transaction.fireCompleteEv
entSet(AbstractModel.java:388)
        at org.netbeans.modules.xml.xam.AbstractModel$Transaction.fireEvents(Abs
tractModel.java:350)
        at org.netbeans.modules.xml.xam.AbstractModel.endTransaction(AbstractMod
el.java:257)
        at org.netbeans.modules.xml.axi.impl.DefaultSchemaGenerator.transformSch
ema(DefaultSchemaGenerator.java:136)
        at org.netbeans.modules.xml.axi.impl.SchemaGeneratorFactoryImpl.transfor
mSchema(SchemaGeneratorFactoryImpl.java:101)
        at org.netbeans.modules.xml.schema.abe.wizard.SchemaTransformWizard$1.ru
n(SchemaTransformWizard.java:115)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:499)

[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java
:932)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerIm
pl.java:416)
        ... 10 more
Caused by: java.lang.StackOverflowError
        at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.jav
a:1007)
        at java.util.Collections$UnmodifiableCollection.iterator(Collections.jav
a:1006)
        at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.jav
a:1007)
        at java.util.Collections$UnmodifiableCollection.iterator(Collections.jav
a:1006)
        at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.jav
a:1007)
        at java.util.Collections$UnmodifiableCollection.iterator(Collections.jav
a:1006)
        at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.jav
a:1007)
        at java.util.Collections$UnmodifiableCollection.iterator(Collections.jav
a:1006)
        at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.jav
a:1007)
        at java.util.Collections$UnmodifiableCollection.iterator(Collections.jav
a:1006)
        at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.jav
a:1007)
        at java.util.Collections$UnmodifiableCollection.iterator(Collections.jav
a:1006)
        at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.jav
a:1007)
        at java.util.Collections$UnmodifiableCollection.iterator(Collections.jav
a:1006)
        at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.jav
a:1007)
Comment 5 Ayub Khan 2006-07-29 01:15:37 UTC
I tried a different approach of creating global elements outside of the
schema model and then adding them. This reduces the events drastically. Also I
don't see the stackoverflow. There are some minor issues

1. Takes 2-3 min for the transformation of flattened OTA. May not be fixable for
beta.
2. I saw some blank lines between some components. I will investigate. Should be
fixable for beta.

I am proceeding in this approach. If there are not regressions, then I will
check in before Sunday 07/30 or waive this bug.
Comment 6 Ayub Khan 2006-07-31 04:55:46 UTC
Requesting waiver for NB55 beta
    *   the bug id and a short description
          o 81266 - StackOverflowError on applying Russian Doll to OTA schema
    * the justification for the waiver
          o Fix requires XDM prettyprint code change, and XDM code is already frozen
    * a statement about user impact (e.g. how often the bug is likely to occur,
behavior after the problem occurs, impact on other features, etc.)
          o Applying design pattern on large schema (like OTA)
    * a workaround description (if available)
          o None
    * an estimation when and how the bug will be fixed
          o Root cause for this bug : In AXI transform code, we keep on mutating
schema model, by visiting AXI model. As a result of the mutation, there the
event size that the XAM can handles grow out of propotion. I had tried with 1GB
memory, even then this issue is reproduced.
          o Fix: Instead of a creating global element, and add it to the schema,
then start mutation, we can create model-less global elements, and then add
later to schema node. This code works, but it causes issues in XDM pretty print.
Current XDM pretty print works on nodes that are added to a parent that is
already in tree. So we need XDM pretty print also to work correctly on
model-less nodes too.

Comment 7 Ayub Khan 2006-08-01 05:53:47 UTC
*** Issue 80711 has been marked as a duplicate of this issue. ***
Comment 8 Ayub Khan 2006-08-01 05:56:33 UTC
Waived for beta
Comment 9 Ayub Khan 2006-08-23 00:31:36 UTC
The issue is that during transform we create a lot of events (as we keep on
populate descendents of a global element or complextype) that the XAM cannot 
handle. TO reduce this size of events, we took the approach of adding the global
element or complex type to schema node after we are done populating with their
descendants. This will lead to few events one each for a global component that
we create. The change need spans XDM pretty print and AXI model schema
generation code.


XDM Changes
===========

Files Affected:
===============
Checking in src/org/netbeans/modules/xml/xdm/xam/XDMAccess.java;
new revision: 1.1.2.20; previous revision: 1.1.2.19

Checking in src/org/netbeans/modules/xml/xdm/nodes/NodeImpl.java;
new revision: 1.2.2.16; previous revision: 1.2.2.15

Checking in src/org/netbeans/modules/xml/xdm/XDMModel.java;
new revision: 1.2.2.43; previous revision: 1.2.2.42

Tests added
============

Checking in test/unit/src/org/netbeans/modules/xml/xdm/diff/prettyprint2.xml;
new revision: 1.1.2.1; previous revision: 1.1

Checking in test/unit/src/org/netbeans/modules/xml/xdm/diff/prettyprint1.xml;
new revision: 1.1.2.1; previous revision: 1.1

Checking in test/unit/src/org/netbeans/modules/xml/xdm/diff/MergeDiffTest.java;
new revision: 1.1.2.12; previous revision: 1.1.2.11

AXI model changes
=================
Files affected:
================

Checking in src/org/netbeans/modules/xml/axi/SchemaGenerator.java;
new revision: 1.1.2.10; previous revision: 1.1.2.9

Checking in src/org/netbeans/modules/xml/axi/impl/SchemaGeneratorUtil.java;
new revision: 1.1.2.1; previous revision: 1.1

Checking in src/org/netbeans/modules/xml/axi/impl/SchemaGeneratorFactoryImpl.java;
new revision: 1.1.2.10; previous revision: 1.1.2.9

Checking in src/org/netbeans/modules/xml/axi/impl/RussianDoll.java;
new revision: 1.1.2.6; previous revision: 1.1.2.5

Checking in src/org/netbeans/modules/xml/axi/impl/Util.java;
new revision: 1.1.2.54; previous revision: 1.1.2.53

Checking in src/org/netbeans/modules/xml/axi/impl/GardenOfEden.java;
new revision: 1.1.2.18; previous revision: 1.1.2.17

Checking in src/org/netbeans/modules/xml/axi/impl/VenetianBlind.java;
new revision: 1.1.2.14; previous revision: 1.1.2.13

Checking in src/org/netbeans/modules/xml/axi/impl/MixedPattern.java;
new revision: 1.1.2.4; previous revision: 1.1.2.3

Checking in src/org/netbeans/modules/xml/axi/impl/SalamiSlice.java;
new revision: 1.1.2.12; previous revision: 1.1.2.11

Checking in src/org/netbeans/modules/xml/axi/impl/DefaultSchemaGenerator.java;
new revision: 1.1.2.27; previous revision: 1.1.2.26

Checking in src/org/netbeans/modules/xml/axi/datatype/Datatype.java;
new revision: 1.1.2.7; previous revision: 1.1.2.6

Test changes:
============

Checking in test/unit/src/org/netbeans/modules/xml/axi/SchemaGeneratorTest.java;
new revision: 1.1.2.9; previous revision: 1.1.2.8

Checking in test/unit/src/org/netbeans/modules/xml/axi/SchemaGeneratorPerfTest.java;
new revision: 1.1.2.9; previous revision: 1.1.2.8

Checking in test/unit/src/org/netbeans/modules/xml/axi/DesignPatternTest.java;
new revision: 1.1.2.20; previous revision: 1.1.2.19

Checking in test/unit/src/org/netbeans/modules/xml/axi/SchemaTransformTest.java;
new revision: 1.1.2.26; previous revision: 1.1.2.25

Checking in test/unit/src/org/netbeans/modules/xml/axi/TestCatalogModel.java;
new revision: 1.1.2.5; previous revision: 1.1.2.4

Checking in
test/unit/src/org/netbeans/modules/xml/axi/SchemaGeneratorDatatypesTest.java;
new revision: 1.1.2.6; previous revision: 1.1.2.5

Comment 10 Andrei Chistiakov 2006-08-25 13:48:20 UTC
Verified in build 060824.