You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Martin Taal <mt...@springsite.com> on 2005/04/19 10:07:25 UTC
Infinite looping with circular dependency between objects and refresh=true
Hi,
I noticed that ojb gets into an infinite loop when there are circular
dependencies between objects and refresh(=true) is specified on the
reference descriptors.
My testcase has a class A which points to B and vice versa and there is
an instance of A (A1) which points to an instance of B (B1) and B1
points back to A1.
When A1 is read and a getB is done the system gets in an infinite loop.
Looking at the stacktrace I see that the following is happening:
When A1 reads B1 then the relations of B1 are refreshed which again gets
A1 from the cache which reads B1 and B1 refreshes its references which
gets A1 from the cache which again refreshes it references etc.
See also the repository.xml below.
Is this really an issue or is my setup wrong?
I am looking at the latest 1.1 cvs version and using the PB api.
Here is my repository.xml:
<!-- class: org.elver.store.test.testcasesimple.B in table: B -->
<class-descriptor class="org.elver.store.test.testcasesimple.B" table="B">
<field-descriptor name="name" column="name" jdbc-type="VARCHAR"
nullable="true"/>
<field-descriptor name="A_ID" column="A_ID" jdbc-type="INTEGER"
nullable="true" access="anonymous"/>
<reference-descriptor name="myA"
class-ref="org.elver.store.test.testcasesimple.A" refresh="true"
auto-update="object" auto-retrieve="true">
<foreignkey field-ref="A_ID" />
</reference-descriptor>
<field-descriptor name="ID" column="ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true" access="anonymous"/>
</class-descriptor>
<!-- class: org.elver.store.test.testcasesimple.A in table: A -->
<class-descriptor class="org.elver.store.test.testcasesimple.A" table="A">
<field-descriptor name="name" column="name" jdbc-type="VARCHAR"
nullable="true"/>
<field-descriptor name="B_ID" column="B_ID" jdbc-type="INTEGER"
nullable="true" access="anonymous"/>
<reference-descriptor name="myB"
class-ref="org.elver.store.test.testcasesimple.B" refresh="true"
auto-update="object" auto-retrieve="true">
<foreignkey field-ref="B_ID" />
</reference-descriptor>
<field-descriptor name="ID" column="ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true" access="anonymous"/>
</class-descriptor>
--
With Regards, Martin Taal
Springsite
Barchman Wuytierslaan 72b
3818 LK Amersfoort
tel: +31 (0)33 462 02 07
fax: +31 (0)33 463 77 12
Mobile: +31 (0)6 288 48 943
email: mtaal@springsite.com
web: www.springsite.com
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Infinite looping with circular dependency between objects and
refresh=true
Posted by Armin Waibel <ar...@apache.org>.
Martin Taal wrote:
> Hi Armin,
> Yes I just tested it with the 1.0.3 cvs branch and it is reproducable.
Strewth!
> Do you want me to enter an issue in jira with an attached example (maybe
> my setup is wrong?)?
>
yes please. I will try to setup an test case for this issue.
Regards,
Armin
> gr. Martin
>
> Armin Waibel wrote:
>
>> Hi Martin,
>>
>> I assume it's a 1.x specific issue. I didn't do the backport of 1.0.x
>> branch to 1.x yet (it's really much work and I didn't find the time to
>> do it). Is it reproduceable with the 1.0.x branch or 1.0.3?
>>
>> regards,
>> Armin
>>
>> Martin Taal wrote:
>>
>>> Hi,
>>> I noticed that ojb gets into an infinite loop when there are circular
>>> dependencies between objects and refresh(=true) is specified on the
>>> reference descriptors.
>>>
>>> My testcase has a class A which points to B and vice versa and there
>>> is an instance of A (A1) which points to an instance of B (B1) and B1
>>> points back to A1.
>>>
>>> When A1 is read and a getB is done the system gets in an infinite loop.
>>>
>>> Looking at the stacktrace I see that the following is happening:
>>> When A1 reads B1 then the relations of B1 are refreshed which again
>>> gets A1 from the cache which reads B1 and B1 refreshes its references
>>> which gets A1 from the cache which again refreshes it references etc.
>>>
>>> See also the repository.xml below.
>>> Is this really an issue or is my setup wrong?
>>>
>>> I am looking at the latest 1.1 cvs version and using the PB api.
>>>
>>> Here is my repository.xml:
>>>
>>> <!-- class: org.elver.store.test.testcasesimple.B in table: B -->
>>> <class-descriptor class="org.elver.store.test.testcasesimple.B"
>>> table="B">
>>>
>>> <field-descriptor name="name" column="name" jdbc-type="VARCHAR"
>>> nullable="true"/>
>>>
>>> <field-descriptor name="A_ID" column="A_ID" jdbc-type="INTEGER"
>>> nullable="true" access="anonymous"/>
>>>
>>> <reference-descriptor name="myA"
>>> class-ref="org.elver.store.test.testcasesimple.A" refresh="true"
>>> auto-update="object" auto-retrieve="true">
>>> <foreignkey field-ref="A_ID" />
>>> </reference-descriptor>
>>> <field-descriptor name="ID" column="ID" jdbc-type="INTEGER"
>>> primarykey="true" autoincrement="true" access="anonymous"/>
>>>
>>> </class-descriptor>
>>>
>>> <!-- class: org.elver.store.test.testcasesimple.A in table: A -->
>>> <class-descriptor class="org.elver.store.test.testcasesimple.A"
>>> table="A">
>>>
>>> <field-descriptor name="name" column="name" jdbc-type="VARCHAR"
>>> nullable="true"/>
>>>
>>> <field-descriptor name="B_ID" column="B_ID" jdbc-type="INTEGER"
>>> nullable="true" access="anonymous"/>
>>>
>>> <reference-descriptor name="myB"
>>> class-ref="org.elver.store.test.testcasesimple.B" refresh="true"
>>> auto-update="object" auto-retrieve="true">
>>> <foreignkey field-ref="B_ID" />
>>> </reference-descriptor>
>>> <field-descriptor name="ID" column="ID" jdbc-type="INTEGER"
>>> primarykey="true" autoincrement="true" access="anonymous"/>
>>>
>>> </class-descriptor>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Infinite looping with circular dependency between objects and
refresh=true
Posted by Martin Taal <mt...@springsite.com>.
Hi Armin,
Yes I just tested it with the 1.0.3 cvs branch and it is reproducable.
Do you want me to enter an issue in jira with an attached example (maybe
my setup is wrong?)?
gr. Martin
Armin Waibel wrote:
> Hi Martin,
>
> I assume it's a 1.x specific issue. I didn't do the backport of 1.0.x
> branch to 1.x yet (it's really much work and I didn't find the time to
> do it). Is it reproduceable with the 1.0.x branch or 1.0.3?
>
> regards,
> Armin
>
> Martin Taal wrote:
>
>> Hi,
>> I noticed that ojb gets into an infinite loop when there are circular
>> dependencies between objects and refresh(=true) is specified on the
>> reference descriptors.
>>
>> My testcase has a class A which points to B and vice versa and there
>> is an instance of A (A1) which points to an instance of B (B1) and B1
>> points back to A1.
>>
>> When A1 is read and a getB is done the system gets in an infinite loop.
>>
>> Looking at the stacktrace I see that the following is happening:
>> When A1 reads B1 then the relations of B1 are refreshed which again
>> gets A1 from the cache which reads B1 and B1 refreshes its references
>> which gets A1 from the cache which again refreshes it references etc.
>>
>> See also the repository.xml below.
>> Is this really an issue or is my setup wrong?
>>
>> I am looking at the latest 1.1 cvs version and using the PB api.
>>
>> Here is my repository.xml:
>>
>> <!-- class: org.elver.store.test.testcasesimple.B in table: B -->
>> <class-descriptor class="org.elver.store.test.testcasesimple.B"
>> table="B">
>>
>> <field-descriptor name="name" column="name" jdbc-type="VARCHAR"
>> nullable="true"/>
>>
>> <field-descriptor name="A_ID" column="A_ID" jdbc-type="INTEGER"
>> nullable="true" access="anonymous"/>
>>
>> <reference-descriptor name="myA"
>> class-ref="org.elver.store.test.testcasesimple.A" refresh="true"
>> auto-update="object" auto-retrieve="true">
>> <foreignkey field-ref="A_ID" />
>> </reference-descriptor>
>> <field-descriptor name="ID" column="ID" jdbc-type="INTEGER"
>> primarykey="true" autoincrement="true" access="anonymous"/>
>>
>> </class-descriptor>
>>
>> <!-- class: org.elver.store.test.testcasesimple.A in table: A -->
>> <class-descriptor class="org.elver.store.test.testcasesimple.A"
>> table="A">
>>
>> <field-descriptor name="name" column="name" jdbc-type="VARCHAR"
>> nullable="true"/>
>>
>> <field-descriptor name="B_ID" column="B_ID" jdbc-type="INTEGER"
>> nullable="true" access="anonymous"/>
>>
>> <reference-descriptor name="myB"
>> class-ref="org.elver.store.test.testcasesimple.B" refresh="true"
>> auto-update="object" auto-retrieve="true">
>> <foreignkey field-ref="B_ID" />
>> </reference-descriptor>
>> <field-descriptor name="ID" column="ID" jdbc-type="INTEGER"
>> primarykey="true" autoincrement="true" access="anonymous"/>
>>
>> </class-descriptor>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
--
With Regards, Martin Taal
Springsite
Barchman Wuytierslaan 72b
3818 LK Amersfoort
tel: +31 (0)33 462 02 07
fax: +31 (0)33 463 77 12
Mobile: +31 (0)6 288 48 943
email: mtaal@springsite.com
web: www.springsite.com
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Infinite looping with circular dependency between objects and
refresh=true
Posted by Armin Waibel <ar...@apache.org>.
Hi Martin,
I assume it's a 1.x specific issue. I didn't do the backport of 1.0.x
branch to 1.x yet (it's really much work and I didn't find the time to
do it). Is it reproduceable with the 1.0.x branch or 1.0.3?
regards,
Armin
Martin Taal wrote:
> Hi,
> I noticed that ojb gets into an infinite loop when there are circular
> dependencies between objects and refresh(=true) is specified on the
> reference descriptors.
>
> My testcase has a class A which points to B and vice versa and there is
> an instance of A (A1) which points to an instance of B (B1) and B1
> points back to A1.
>
> When A1 is read and a getB is done the system gets in an infinite loop.
>
> Looking at the stacktrace I see that the following is happening:
> When A1 reads B1 then the relations of B1 are refreshed which again gets
> A1 from the cache which reads B1 and B1 refreshes its references which
> gets A1 from the cache which again refreshes it references etc.
>
> See also the repository.xml below.
> Is this really an issue or is my setup wrong?
>
> I am looking at the latest 1.1 cvs version and using the PB api.
>
> Here is my repository.xml:
>
> <!-- class: org.elver.store.test.testcasesimple.B in table: B -->
> <class-descriptor class="org.elver.store.test.testcasesimple.B" table="B">
>
> <field-descriptor name="name" column="name" jdbc-type="VARCHAR"
> nullable="true"/>
>
> <field-descriptor name="A_ID" column="A_ID" jdbc-type="INTEGER"
> nullable="true" access="anonymous"/>
>
> <reference-descriptor name="myA"
> class-ref="org.elver.store.test.testcasesimple.A" refresh="true"
> auto-update="object" auto-retrieve="true">
> <foreignkey field-ref="A_ID" />
> </reference-descriptor>
> <field-descriptor name="ID" column="ID" jdbc-type="INTEGER"
> primarykey="true" autoincrement="true" access="anonymous"/>
>
> </class-descriptor>
>
> <!-- class: org.elver.store.test.testcasesimple.A in table: A -->
> <class-descriptor class="org.elver.store.test.testcasesimple.A" table="A">
>
> <field-descriptor name="name" column="name" jdbc-type="VARCHAR"
> nullable="true"/>
>
> <field-descriptor name="B_ID" column="B_ID" jdbc-type="INTEGER"
> nullable="true" access="anonymous"/>
>
> <reference-descriptor name="myB"
> class-ref="org.elver.store.test.testcasesimple.B" refresh="true"
> auto-update="object" auto-retrieve="true">
> <foreignkey field-ref="B_ID" />
> </reference-descriptor>
> <field-descriptor name="ID" column="ID" jdbc-type="INTEGER"
> primarykey="true" autoincrement="true" access="anonymous"/>
>
> </class-descriptor>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org