You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Marek Šabo <ms...@buk.cvut.cz> on 2010/01/05 21:13:36 UTC

DataObject expiring?

Hi all,

is there any way that a dataobject could expire? I mean i'm storing 
user's settings dataobject in session and after a while, say max 5 min. 
when I try to submit a form that binds this data as foreign key I got a 
nullpointer exception from setting up that relationship. I think it 
does't expire in session because I'm still logged in and only way is to 
logout and login back to have the setting reloaded from database. 
Appending end of stacktrace:

        at 
org.apache.cayenne.util.RelationshipFault.isTransientParent(RelationshipFault.java:70)
        at 
org.apache.cayenne.util.PersistentObjectList.isFault(PersistentObjectList.java:75)
        at 
org.apache.cayenne.util.PersistentObjectList.add(PersistentObjectList.java:125)
        at 
org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:282)
        at 
org.apache.cayenne.CayenneDataObject.setReverseRelationship(CayenneDataObject.java:364)
        at 
org.apache.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.java:315)

Thanks for any ideas,

Regards

-- 
Marek Šabo



Re: DataObject expiring?

Posted by Marek Šabo <ms...@buk.cvut.cz>.
Well, no luck so far, I didn't manage to reproduce this so I'm not sure 
if I should open a bug. Maybe if the issue will rise again sometime in 
the future.

Marek

Marek Šabo wrote:
> I will try to reproduce it and open detailed issue.
>
> Regards,
>
> Marek
>
>
> Bryan Lewis wrote:
>> Marek, would you like the honor of opening the Jira?  Your stack 
>> trace will
>> be more useful than my story.
>>
>>
>> On Wed, Jan 6, 2010 at 5:25 AM, Andrus Adamchik 
>> <an...@objectstyle.org>wrote:
>>
>>  
>>> Would you mind opening a Jira with these details and include the JVM
>>> version and maybe the CPU type on your server?
>>>
>>> Weak references in Cayenne 3.0 are at the ObjectStore level and 
>>> should not
>>> affect relationships, if Java works correctly. I.e. related objects are
>>> store via hard references.
>>>
>>> Andrus
>>>
>>>
>>>
>>>
>>> On Jan 6, 2010, at 4:45 AM, Bryan Lewis wrote:
>>>
>>>  This rings a bit of a bell with me.  We made our first big release 
>>> with
>>>    
>>>> Cayenne 3.0 a couple of weeks ago (it went well, thank you) and saw a
>>>> similar-sounding problem.  It happened only intermittently and only 
>>>> on our
>>>> production server.  We could never reproduce it on our test server, 
>>>> let
>>>> alone in a debugger.
>>>>
>>>> We had an object stored in the session.  Our editor-page 
>>>> initialization
>>>> code
>>>> got the object and then the value of its to-one relationship.  This
>>>> related
>>>> object would occasionally be null.
>>>>
>>>>  StoryDetail object from session  ---to-one--->  Story   (occasionally
>>>> null)
>>>>
>>>> We couldn't pin down how to reproduce it.  (The user it kept 
>>>> happening too
>>>> works very remotely.)  My guess was some kind of garbage 
>>>> collection.  The
>>>> user would enter a lot of text for several minutes and then 
>>>> save/refresh
>>>> the
>>>> page and get the NPE.  The other hint was that the same code had 
>>>> never had
>>>> a
>>>> problem in two years with Cayenne 2.  On the other hand, I was 
>>>> unable to
>>>> reproduce it by adding explicit garbage collection calls so my 
>>>> guess could
>>>> be off base.
>>>>
>>>> I worked around it by refetching the list of StoryDetails, with a 
>>>> prefetch
>>>> on Story, so that the desired Story object would always be freshly
>>>> fetched.
>>>>
>>>>
>>>>
>>>> On Tue, Jan 5, 2010 at 3:31 PM, Andrus Adamchik 
>>>> <andrus@objectstyle.org
>>>>      
>>>>> wrote:
>>>>>         
>>>>  On the surface looks like some (de)serialization issue. Although that
>>>>      
>>>>> doesn't make much sense, as RelationshipFault.relationshipOwner is 
>>>>> not
>>>>> transient and can't be reset to null easily. The best bet is to 
>>>>> run this
>>>>> in
>>>>> debugger to get a better picture of what's going on with your 
>>>>> objects.
>>>>>
>>>>> Andrus
>>>>>
>>>>>
>>>>> On Jan 5, 2010, at 10:13 PM, Marek Šabo wrote:
>>>>>
>>>>>  Hi all,
>>>>>        
>>>>>> is there any way that a dataobject could expire? I mean i'm storing
>>>>>> user's
>>>>>> settings dataobject in session and after a while, say max 5 min. 
>>>>>> when I
>>>>>> try
>>>>>> to submit a form that binds this data as foreign key I got a 
>>>>>> nullpointer
>>>>>> exception from setting up that relationship. I think it does't 
>>>>>> expire in
>>>>>> session because I'm still logged in and only way is to logout and 
>>>>>> login
>>>>>> back
>>>>>> to have the setting reloaded from database. Appending end of 
>>>>>> stacktrace:
>>>>>>
>>>>>>    at
>>>>>>
>>>>>> org.apache.cayenne.util.RelationshipFault.isTransientParent(RelationshipFault.java:70) 
>>>>>>
>>>>>>    at
>>>>>>
>>>>>> org.apache.cayenne.util.PersistentObjectList.isFault(PersistentObjectList.java:75) 
>>>>>>
>>>>>>    at
>>>>>>
>>>>>> org.apache.cayenne.util.PersistentObjectList.add(PersistentObjectList.java:125) 
>>>>>>
>>>>>>    at
>>>>>>
>>>>>> org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:282) 
>>>>>>
>>>>>>    at
>>>>>>
>>>>>> org.apache.cayenne.CayenneDataObject.setReverseRelationship(CayenneDataObject.java:364) 
>>>>>>
>>>>>>    at
>>>>>>
>>>>>> org.apache.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.java:315) 
>>>>>>
>>>>>>
>>>>>> Thanks for any ideas,
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> -- 
>>>>>> Marek Šabo
>>>>>>
>>>>>>
>>>>>>           
>>>>>         
>>
>>   
>


-- 
Marek Šabo
Server Manager
Club SU CVUT Buben
Bubenečská Kolej (421)
XMPP: zeratul021@gmail.com


Re: DataObject expiring?

Posted by Marek Šabo <ms...@buk.cvut.cz>.
I will try to reproduce it and open detailed issue.

Regards,

Marek


Bryan Lewis wrote:
> Marek, would you like the honor of opening the Jira?  Your stack trace will
> be more useful than my story.
>
>
> On Wed, Jan 6, 2010 at 5:25 AM, Andrus Adamchik <an...@objectstyle.org>wrote:
>
>   
>> Would you mind opening a Jira with these details and include the JVM
>> version and maybe the CPU type on your server?
>>
>> Weak references in Cayenne 3.0 are at the ObjectStore level and should not
>> affect relationships, if Java works correctly. I.e. related objects are
>> store via hard references.
>>
>> Andrus
>>
>>
>>
>>
>> On Jan 6, 2010, at 4:45 AM, Bryan Lewis wrote:
>>
>>  This rings a bit of a bell with me.  We made our first big release with
>>     
>>> Cayenne 3.0 a couple of weeks ago (it went well, thank you) and saw a
>>> similar-sounding problem.  It happened only intermittently and only on our
>>> production server.  We could never reproduce it on our test server, let
>>> alone in a debugger.
>>>
>>> We had an object stored in the session.  Our editor-page initialization
>>> code
>>> got the object and then the value of its to-one relationship.  This
>>> related
>>> object would occasionally be null.
>>>
>>>  StoryDetail object from session  ---to-one--->  Story   (occasionally
>>> null)
>>>
>>> We couldn't pin down how to reproduce it.  (The user it kept happening too
>>> works very remotely.)  My guess was some kind of garbage collection.  The
>>> user would enter a lot of text for several minutes and then save/refresh
>>> the
>>> page and get the NPE.  The other hint was that the same code had never had
>>> a
>>> problem in two years with Cayenne 2.  On the other hand, I was unable to
>>> reproduce it by adding explicit garbage collection calls so my guess could
>>> be off base.
>>>
>>> I worked around it by refetching the list of StoryDetails, with a prefetch
>>> on Story, so that the desired Story object would always be freshly
>>> fetched.
>>>
>>>
>>>
>>> On Tue, Jan 5, 2010 at 3:31 PM, Andrus Adamchik <andrus@objectstyle.org
>>>       
>>>> wrote:
>>>>         
>>>  On the surface looks like some (de)serialization issue. Although that
>>>       
>>>> doesn't make much sense, as RelationshipFault.relationshipOwner is not
>>>> transient and can't be reset to null easily. The best bet is to run this
>>>> in
>>>> debugger to get a better picture of what's going on with your objects.
>>>>
>>>> Andrus
>>>>
>>>>
>>>> On Jan 5, 2010, at 10:13 PM, Marek Šabo wrote:
>>>>
>>>>  Hi all,
>>>>         
>>>>> is there any way that a dataobject could expire? I mean i'm storing
>>>>> user's
>>>>> settings dataobject in session and after a while, say max 5 min. when I
>>>>> try
>>>>> to submit a form that binds this data as foreign key I got a nullpointer
>>>>> exception from setting up that relationship. I think it does't expire in
>>>>> session because I'm still logged in and only way is to logout and login
>>>>> back
>>>>> to have the setting reloaded from database. Appending end of stacktrace:
>>>>>
>>>>>    at
>>>>>
>>>>> org.apache.cayenne.util.RelationshipFault.isTransientParent(RelationshipFault.java:70)
>>>>>    at
>>>>>
>>>>> org.apache.cayenne.util.PersistentObjectList.isFault(PersistentObjectList.java:75)
>>>>>    at
>>>>>
>>>>> org.apache.cayenne.util.PersistentObjectList.add(PersistentObjectList.java:125)
>>>>>    at
>>>>>
>>>>> org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:282)
>>>>>    at
>>>>>
>>>>> org.apache.cayenne.CayenneDataObject.setReverseRelationship(CayenneDataObject.java:364)
>>>>>    at
>>>>>
>>>>> org.apache.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.java:315)
>>>>>
>>>>> Thanks for any ideas,
>>>>>
>>>>> Regards
>>>>>
>>>>> --
>>>>> Marek Šabo
>>>>>
>>>>>
>>>>>           
>>>>         
>
>   

-- 
Marek Šabo
Server Manager
Club SU CVUT Buben
Bubenečská Kolej (421)
XMPP: zeratul021@gmail.com


Re: DataObject expiring?

Posted by Bryan Lewis <jb...@gmail.com>.
Marek, would you like the honor of opening the Jira?  Your stack trace will
be more useful than my story.


On Wed, Jan 6, 2010 at 5:25 AM, Andrus Adamchik <an...@objectstyle.org>wrote:

> Would you mind opening a Jira with these details and include the JVM
> version and maybe the CPU type on your server?
>
> Weak references in Cayenne 3.0 are at the ObjectStore level and should not
> affect relationships, if Java works correctly. I.e. related objects are
> store via hard references.
>
> Andrus
>
>
>
>
> On Jan 6, 2010, at 4:45 AM, Bryan Lewis wrote:
>
>  This rings a bit of a bell with me.  We made our first big release with
>> Cayenne 3.0 a couple of weeks ago (it went well, thank you) and saw a
>> similar-sounding problem.  It happened only intermittently and only on our
>> production server.  We could never reproduce it on our test server, let
>> alone in a debugger.
>>
>> We had an object stored in the session.  Our editor-page initialization
>> code
>> got the object and then the value of its to-one relationship.  This
>> related
>> object would occasionally be null.
>>
>>  StoryDetail object from session  ---to-one--->  Story   (occasionally
>> null)
>>
>> We couldn't pin down how to reproduce it.  (The user it kept happening too
>> works very remotely.)  My guess was some kind of garbage collection.  The
>> user would enter a lot of text for several minutes and then save/refresh
>> the
>> page and get the NPE.  The other hint was that the same code had never had
>> a
>> problem in two years with Cayenne 2.  On the other hand, I was unable to
>> reproduce it by adding explicit garbage collection calls so my guess could
>> be off base.
>>
>> I worked around it by refetching the list of StoryDetails, with a prefetch
>> on Story, so that the desired Story object would always be freshly
>> fetched.
>>
>>
>>
>> On Tue, Jan 5, 2010 at 3:31 PM, Andrus Adamchik <andrus@objectstyle.org
>> >wrote:
>>
>>  On the surface looks like some (de)serialization issue. Although that
>>> doesn't make much sense, as RelationshipFault.relationshipOwner is not
>>> transient and can't be reset to null easily. The best bet is to run this
>>> in
>>> debugger to get a better picture of what's going on with your objects.
>>>
>>> Andrus
>>>
>>>
>>> On Jan 5, 2010, at 10:13 PM, Marek Šabo wrote:
>>>
>>>  Hi all,
>>>>
>>>> is there any way that a dataobject could expire? I mean i'm storing
>>>> user's
>>>> settings dataobject in session and after a while, say max 5 min. when I
>>>> try
>>>> to submit a form that binds this data as foreign key I got a nullpointer
>>>> exception from setting up that relationship. I think it does't expire in
>>>> session because I'm still logged in and only way is to logout and login
>>>> back
>>>> to have the setting reloaded from database. Appending end of stacktrace:
>>>>
>>>>    at
>>>>
>>>> org.apache.cayenne.util.RelationshipFault.isTransientParent(RelationshipFault.java:70)
>>>>    at
>>>>
>>>> org.apache.cayenne.util.PersistentObjectList.isFault(PersistentObjectList.java:75)
>>>>    at
>>>>
>>>> org.apache.cayenne.util.PersistentObjectList.add(PersistentObjectList.java:125)
>>>>    at
>>>>
>>>> org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:282)
>>>>    at
>>>>
>>>> org.apache.cayenne.CayenneDataObject.setReverseRelationship(CayenneDataObject.java:364)
>>>>    at
>>>>
>>>> org.apache.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.java:315)
>>>>
>>>> Thanks for any ideas,
>>>>
>>>> Regards
>>>>
>>>> --
>>>> Marek Šabo
>>>>
>>>>
>>>
>>>
>

Re: DataObject expiring?

Posted by Andrus Adamchik <an...@objectstyle.org>.
Would you mind opening a Jira with these details and include the JVM  
version and maybe the CPU type on your server?

Weak references in Cayenne 3.0 are at the ObjectStore level and should  
not affect relationships, if Java works correctly. I.e. related  
objects are store via hard references.

Andrus



On Jan 6, 2010, at 4:45 AM, Bryan Lewis wrote:

> This rings a bit of a bell with me.  We made our first big release  
> with
> Cayenne 3.0 a couple of weeks ago (it went well, thank you) and saw a
> similar-sounding problem.  It happened only intermittently and only  
> on our
> production server.  We could never reproduce it on our test server,  
> let
> alone in a debugger.
>
> We had an object stored in the session.  Our editor-page  
> initialization code
> got the object and then the value of its to-one relationship.  This  
> related
> object would occasionally be null.
>
>  StoryDetail object from session  ---to-one--->  Story   (occasionally
> null)
>
> We couldn't pin down how to reproduce it.  (The user it kept  
> happening too
> works very remotely.)  My guess was some kind of garbage  
> collection.  The
> user would enter a lot of text for several minutes and then save/ 
> refresh the
> page and get the NPE.  The other hint was that the same code had  
> never had a
> problem in two years with Cayenne 2.  On the other hand, I was  
> unable to
> reproduce it by adding explicit garbage collection calls so my guess  
> could
> be off base.
>
> I worked around it by refetching the list of StoryDetails, with a  
> prefetch
> on Story, so that the desired Story object would always be freshly  
> fetched.
>
>
>
> On Tue, Jan 5, 2010 at 3:31 PM, Andrus Adamchik <andrus@objectstyle.org 
> >wrote:
>
>> On the surface looks like some (de)serialization issue. Although that
>> doesn't make much sense, as RelationshipFault.relationshipOwner is  
>> not
>> transient and can't be reset to null easily. The best bet is to run  
>> this in
>> debugger to get a better picture of what's going on with your  
>> objects.
>>
>> Andrus
>>
>>
>> On Jan 5, 2010, at 10:13 PM, Marek Šabo wrote:
>>
>>> Hi all,
>>>
>>> is there any way that a dataobject could expire? I mean i'm  
>>> storing user's
>>> settings dataobject in session and after a while, say max 5 min.  
>>> when I try
>>> to submit a form that binds this data as foreign key I got a  
>>> nullpointer
>>> exception from setting up that relationship. I think it does't  
>>> expire in
>>> session because I'm still logged in and only way is to logout and  
>>> login back
>>> to have the setting reloaded from database. Appending end of  
>>> stacktrace:
>>>
>>>     at
>>> org 
>>> .apache 
>>> .cayenne 
>>> .util.RelationshipFault.isTransientParent(RelationshipFault.java:70)
>>>     at
>>> org 
>>> .apache 
>>> .cayenne 
>>> .util.PersistentObjectList.isFault(PersistentObjectList.java:75)
>>>     at
>>> org 
>>> .apache 
>>> .cayenne.util.PersistentObjectList.add(PersistentObjectList.java: 
>>> 125)
>>>     at
>>> org 
>>> .apache 
>>> .cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java: 
>>> 282)
>>>     at
>>> org 
>>> .apache 
>>> .cayenne 
>>> .CayenneDataObject.setReverseRelationship(CayenneDataObject.java: 
>>> 364)
>>>     at
>>> org 
>>> .apache 
>>> .cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.java: 
>>> 315)
>>>
>>> Thanks for any ideas,
>>>
>>> Regards
>>>
>>> --
>>> Marek Šabo
>>>
>>
>>


Re: DataObject expiring?

Posted by Bryan Lewis <jb...@gmail.com>.
This rings a bit of a bell with me.  We made our first big release with
Cayenne 3.0 a couple of weeks ago (it went well, thank you) and saw a
similar-sounding problem.  It happened only intermittently and only on our
production server.  We could never reproduce it on our test server, let
alone in a debugger.

We had an object stored in the session.  Our editor-page initialization code
got the object and then the value of its to-one relationship.  This related
object would occasionally be null.

  StoryDetail object from session  ---to-one--->  Story   (occasionally
null)

We couldn't pin down how to reproduce it.  (The user it kept happening too
works very remotely.)  My guess was some kind of garbage collection.  The
user would enter a lot of text for several minutes and then save/refresh the
page and get the NPE.  The other hint was that the same code had never had a
problem in two years with Cayenne 2.  On the other hand, I was unable to
reproduce it by adding explicit garbage collection calls so my guess could
be off base.

I worked around it by refetching the list of StoryDetails, with a prefetch
on Story, so that the desired Story object would always be freshly fetched.



On Tue, Jan 5, 2010 at 3:31 PM, Andrus Adamchik <an...@objectstyle.org>wrote:

> On the surface looks like some (de)serialization issue. Although that
> doesn't make much sense, as RelationshipFault.relationshipOwner is not
> transient and can't be reset to null easily. The best bet is to run this in
> debugger to get a better picture of what's going on with your objects.
>
> Andrus
>
>
> On Jan 5, 2010, at 10:13 PM, Marek Šabo wrote:
>
>> Hi all,
>>
>> is there any way that a dataobject could expire? I mean i'm storing user's
>> settings dataobject in session and after a while, say max 5 min. when I try
>> to submit a form that binds this data as foreign key I got a nullpointer
>> exception from setting up that relationship. I think it does't expire in
>> session because I'm still logged in and only way is to logout and login back
>> to have the setting reloaded from database. Appending end of stacktrace:
>>
>>      at
>> org.apache.cayenne.util.RelationshipFault.isTransientParent(RelationshipFault.java:70)
>>      at
>> org.apache.cayenne.util.PersistentObjectList.isFault(PersistentObjectList.java:75)
>>      at
>> org.apache.cayenne.util.PersistentObjectList.add(PersistentObjectList.java:125)
>>      at
>> org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:282)
>>      at
>> org.apache.cayenne.CayenneDataObject.setReverseRelationship(CayenneDataObject.java:364)
>>      at
>> org.apache.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.java:315)
>>
>> Thanks for any ideas,
>>
>> Regards
>>
>> --
>> Marek Šabo
>>
>
>

Re: DataObject expiring?

Posted by Andrus Adamchik <an...@objectstyle.org>.
On the surface looks like some (de)serialization issue. Although that  
doesn't make much sense, as RelationshipFault.relationshipOwner is not  
transient and can't be reset to null easily. The best bet is to run  
this in debugger to get a better picture of what's going on with your  
objects.

Andrus

On Jan 5, 2010, at 10:13 PM, Marek Šabo wrote:
> Hi all,
>
> is there any way that a dataobject could expire? I mean i'm storing  
> user's settings dataobject in session and after a while, say max 5  
> min. when I try to submit a form that binds this data as foreign key  
> I got a nullpointer exception from setting up that relationship. I  
> think it does't expire in session because I'm still logged in and  
> only way is to logout and login back to have the setting reloaded  
> from database. Appending end of stacktrace:
>
>       at  
> org 
> .apache 
> .cayenne 
> .util.RelationshipFault.isTransientParent(RelationshipFault.java:70)
>       at  
> org 
> .apache 
> .cayenne.util.PersistentObjectList.isFault(PersistentObjectList.java: 
> 75)
>       at  
> org 
> .apache 
> .cayenne.util.PersistentObjectList.add(PersistentObjectList.java:125)
>       at  
> org 
> .apache 
> .cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:282)
>       at  
> org 
> .apache 
> .cayenne 
> .CayenneDataObject.setReverseRelationship(CayenneDataObject.java:364)
>       at  
> org 
> .apache 
> .cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.java:315)
>
> Thanks for any ideas,
>
> Regards
>
> -- 
> Marek Šabo