Deleted objects showing up a serialized data context

From: Mike Kienenberger (mkienen..mail.com)
Date: Tue Jul 25 2006 - 21:24:12 EDT

  • Next message: Tobias SCHOESSLER: "Clear DataContext Cache"

    I'm now using incubator/cayenne/main/branches/STABLE-1.2.

    One odd problem I'm hitting is serializing a DataContext created with
    DataContext.createDataContext().

    In my testing, I submit a web request that creates a new object,
    submit a web request which creates another set of new objects and
    assign it to relationships with my first new object, then submit a web
    request which deletes the set of new objects. At this point,
    serialization writeObject fails on one of my internal assertions,
    apparently because the deleted object is still in the context.

    Here's what the summarized stack trace looks like (full trace below):

    8 Fee(BaseDataObjectImpl).writeObject(ObjectOutputStream) line: 95
    7 HashMap.writeObject(ObjectOutputStream) line: 978
    6 FeeCycle(CayenneDataObject).writeObject(ObjectOutputStream) line: 497
    5 LinkedList.writeObject(ObjectOutputStream) line: 685
    4 HashMap.writeObject(ObjectOutputStream) line: 978
    3 FeeCycleType(CayenneDataObject).writeObject(ObjectOutputStream) line: 497
    2 HashMap.writeObject(ObjectOutputStream) line: 978
    1 DataContext.writeObject(ObjectOutputStream) line: 1740

    Fee in 8 and FeeCycle in 6 are transient objects -- no datacontext.
     FeeCycleType in 3 is a committed object. It's a mystery to me how
    FeeCycle in 6 is being picked up by the writeObject method chain.

    My thoughts are that FeeCycle must be referenced in the hashmap at 4
    for the FeeCycleType at 3.

    The hashmap at 4 contains:

    name=Monthly
    feeCycleList=org.objectstyle.cayenne.access.ToManyLis..0

    and the ToManyList contains:

    value= ToManyList (id=614)
            addedToUnresolved= null
            objectList= ArrayList (id=621)
                    elementData= Object[10] (id=655)
                    modCount= 0
                    size= 0
            relationship= "feeCycleList"
            removedFromUnresolved= null
            source= FeeCycleType (id=400)

    So what I'm at a loss to determine is how I get from the Hashmap in 4
    to the LinkedList in 5, which is what contains my transient deleted
    object (and related deleted objects).

    The LinkedList in 5 contains:

    this= LinkedList (id=394)
            header= LinkedList$Entry (id=641)
                    element= null
                    next= LinkedList$Entry (id=673)
                            element= FeeCycle (id=387)
                                    isInTemporaryDataContext= true
                                    objectContext= null
                                    objectId= null
                                    persistenceState= 1
                                    snapshotVersion= 0
                                    values= HashMap (id=375)
                            next= LinkedList$Entry (id=641)
                            previous= LinkedList$Entry (id=641)
                    previous= LinkedList$Entry (id=673)
            modCount= 1
            size= 1

    The writeObject code for HashMap seems straight-forward, and we're
    supposedly writing out a Map.Entry e getValue() result (debugger won't
    show me what local variables are set to, but that's the line that's
    showing up in my source code).

    It seems like this linked list must be part of the serialization of
    ToManyList (which does contain two linked lists), but looking at the
    source for ToManyList, I don't see anything that matches up with what
    I'd expect.

    It looks like it must be serializing either addedToUnresolved or
    removedFromUnresolved as these are the LinkedLists, but both of these
    are null.

    So.... Any ideas what I can do to try to track this down more?

    =================
    Possibly other relevent information:

    I assume that 2 is writing out the hashmap of the ObjectStore, which
    contains these 13 items. There's no Fee reference here, nor are
    there any references to non-committed FeeCycles.

    <ObjectId:Contact, TEMP:000002574DF30161>={<ObjectId:Contact,
    TEMP:000002574DF30161>; new; [phoneList=>(..); addressList=>(..);
    contactNameList=>(..); tdWorkList=>(..); emailList=>(..);
    primaryContactName=>{<ObjectId:ContactName, TEMP:000003574DF30161>}]}
    <ObjectId:ContactName, TEMP:000003574DF30161>={<ObjectId:ContactName,
    TEMP:000003574DF30161>; new; [allContactList=>(..);
    primaryContactList=>(..)]}
    <ObjectId:FeeCycleType,
    FEE_CYCLE_TYPE_ID=100>={<ObjectId:FeeCycleType,
    FEE_CYCLE_TYPE_ID=100>; modified; [feeCycleList=>(..); name=>None]}
    <ObjectId:MonthPayableType,
    MONTH_PAYABLE_TYPE_ID=113>={<ObjectId:MonthPayableType,
    MONTH_PAYABLE_TYPE_ID=113>; modified; [feeCycleList=>(..);
    name=>Monthly]}
    <ObjectId:LegalParcel, TEMP:000006574DF30161>={<ObjectId:LegalParcel,
    TEMP:000006574DF30161>; new; [meridianType=>{<ObjectId:MeridianType,
    MERIDIAN_TYPE_ID=100>}; authorizationDocumentList=>(..);
    parcel=>{<ObjectId:Parcel, TEMP:000007574DF30161>}]}
    <ObjectId:ContactName, TEMP:000005574DF30161>={<ObjectId:ContactName,
    TEMP:000005574DF30161>; new; [allContactList=>(..); fullName=>GVEA;
    primaryContactList=>(..)]}
    <ObjectId:MeridianType, MERIDIAN_TYPE_ID=100>={<ObjectId:MeridianType,
    MERIDIAN_TYPE_ID=100>; modified; [name=>Fairbanks;
    legalParcelList=>(..)]}
    <ObjectId:LotType, LOT_TYPE_ID=100>={<ObjectId:LotType,
    LOT_TYPE_ID=100>; modified; [parcelList=>(..); name=>Lot]}
    <ObjectId:AuthorizationDocument,
    TEMP:000001574DF30161>={<ObjectId:AuthorizationDocument,
    TEMP:000001574DF30161>; new;
    [dependentEasementDocument=>{<ObjectId:EasementDocument,
    TEMP:000000574DF30161>}; recurringFeeCycle=>null;
    authorizationDocumentGroupList=>(..); initialFeeCycle=>null;
    oldWorkOrderList=>(..); workList=>(..); legalParcelList=>(..)]}
    <ObjectId:Parcel, TEMP:000007574DF30161>={<ObjectId:Parcel,
    TEMP:000007574DF30161>; new; [legalParcel=>{<ObjectId:LegalParcel,
    TEMP:000006574DF30161>}; lotType=>{<ObjectId:LotType,
    LOT_TYPE_ID=100>}; tdWorkList=>(..)]}
    <ObjectId:EasementDocument,
    TEMP:000000574DF30161>={<ObjectId:EasementDocument,
    TEMP:000000574DF30161>; new; [grantorList=>(..);
    authorizationDocument=>{<ObjectId:AuthorizationDocument,
    TEMP:000001574DF30161>}; granteeList=>(..)]}
    <ObjectId:FeeCycleType,
    FEE_CYCLE_TYPE_ID=101>={<ObjectId:FeeCycleType,
    FEE_CYCLE_TYPE_ID=101>; modified; [feeCycleList=>(..); name=>Monthly]}
    <ObjectId:Contact, TEMP:000004574DF30161>={<ObjectId:Contact,
    TEMP:000004574DF30161>; new; [phoneList=>(..); addressList=>(..);
    contactNameList=>(..); tdWorkList=>(..); emailList=>(..);
    primaryContactName=>{<ObjectId:ContactName, TEMP:000005574DF30161>}]}

    =================

    Thread [SocketListener0-0] (Suspended (breakpoint at line 95 in
    BaseDataObjectImpl))
            Fee(BaseDataObjectImpl).writeObject(ObjectOutputStream) line: 95
            GeneratedMethodAccessor171.invoke(Object, Object[]) line: not available
            DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
            Method.invoke(Object, Object[]) line: 324
            ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
            ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
            ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
    boolean) line: 1247
            ObjectOutputStream.writeObject0(Object, boolean) line: 1052
            ObjectOutputStream.writeObject(Object) line: 278
            HashMap.writeObject(ObjectOutputStream) line: 978
            GeneratedMethodAccessor75.invoke(Object, Object[]) line: not available
            DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
            Method.invoke(Object, Object[]) line: 324
            ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
            ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
            ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
    boolean) line: 1247
            ObjectOutputStream.writeObject0(Object, boolean) line: 1052
            ObjectOutputStream.writeObject(Object) line: 278
            FeeCycle(CayenneDataObject).writeObject(ObjectOutputStream) line: 497
            GeneratedMethodAccessor170.invoke(Object, Object[]) line: not available
            DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
            Method.invoke(Object, Object[]) line: 324
            ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
            ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
            ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
    boolean) line: 1247
            ObjectOutputStream.writeObject0(Object, boolean) line: 1052
            ObjectOutputStream.writeObject(Object) line: 278
            LinkedList.writeObject(ObjectOutputStream) line: 685
            GeneratedMethodAccessor162.invoke(Object, Object[]) line: not available
            DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
            Method.invoke(Object, Object[]) line: 324
            ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
            ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
            ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
    boolean) line: 1247
            ObjectOutputStream.writeObject0(Object, boolean) line: 1052
            ObjectOutputStream.defaultWriteFields(Object, ObjectStreamClass) line: 1332
            ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1304
            ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
    boolean) line: 1247
            ObjectOutputStream.writeObject0(Object, boolean) line: 1052
            ObjectOutputStream.writeObject(Object) line: 278
            HashMap.writeObject(ObjectOutputStream) line: 978
            GeneratedMethodAccessor75.invoke(Object, Object[]) line: not available
            DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
            Method.invoke(Object, Object[]) line: 324
            ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
            ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
            ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
    boolean) line: 1247
            ObjectOutputStream.writeObject0(Object, boolean) line: 1052
            ObjectOutputStream.writeObject(Object) line: 278
            FeeCycleType(CayenneDataObject).writeObject(ObjectOutputStream) line: 497
            GeneratedMethodAccessor170.invoke(Object, Object[]) line: not available
            DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
            Method.invoke(Object, Object[]) line: 324
            ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
            ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
            ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
    boolean) line: 1247
            ObjectOutputStream.writeObject0(Object, boolean) line: 1052
            ObjectOutputStream.writeObject(Object) line: 278
            HashMap.writeObject(ObjectOutputStream) line: 978
            GeneratedMethodAccessor75.invoke(Object, Object[]) line: not available
            DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
            Method.invoke(Object, Object[]) line: 324
            ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
            ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
            ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
    boolean) line: 1247
            ObjectOutputStream.writeObject0(Object, boolean) line: 1052
            ObjectOutputStream.defaultWriteFields(Object, ObjectStreamClass) line: 1332
            ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1304
            ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
    boolean) line: 1247
            ObjectOutputStream.writeObject0(Object, boolean) line: 1052
            ObjectOutputStream.defaultWriteFields(Object, ObjectStreamClass) line: 1332
            ObjectOutputStream.defaultWriteObject() line: 367
            DataContext.writeObject(ObjectOutputStream) line: 1740



    This archive was generated by hypermail 2.0.0 : Tue Jul 25 2006 - 21:24:37 EDT