CodeSmith Community
Your Code. Your Way. Faster!

Problem with deepload

Latest post 08-01-2007 3:28 PM by costasz. 13 replies.
  • 01-02-2007 4:55 PM

    • JJmartin
    • Top 25 Contributor
    • Joined on 05-22-2006
    • Phoenix, AZ
    • Posts 164
    • Points 3,275

    Problem with deepload

    i was having a problem with stack overflowing durring a deepload  had SVN 464 (i think).  I am reverting to 453 for now... will see if that helps.

     

    -Jeff Martin C# MCSD
    Filed under:
    • Post Points: 5
  • 01-02-2007 6:53 PM In reply to

    • JJmartin
    • Top 25 Contributor
    • Joined on 05-22-2006
    • Phoenix, AZ
    • Posts 164
    • Points 3,275

    Re: Problem with deepload

    I think something is with the current implementation of the DeepLoad.   I am using the 462 version of the EntityProviderBaseCore.generated.cst file.

    code that worked fine before is giving me stack over flow errors (recursion).

    my previous code was nice and simple.  In order to get things working again I had to do most of the object loading manually. (See Current Code)

    Previous code:

    Type[] types = new Type[] { typeof(Zone), typeof(ObjectPermission), typeof(SecureObject), typeof(AspnetRoles), typeof(TList<ObjectPermission>) };

    DataRepository.WebPageProvider.DeepLoad(_webPages,true, DeepLoadType.IncludeChildren, types);

    Current Code:

    Type[] types = new Type[] { typeof(Zone), typeof(ObjectPermission), typeof(SecureObject), typeof(AspnetRoles), typeof(TList<ObjectPermission>) };

    DataRepository.WebPageProvider.DeepLoad(_webPages,false, DeepLoadType.IncludeChildren, types);

    foreach (WebPage page in _webPages)

    {

    if (page != null && page.ZoneIdSource != null )

    {

    page.ZoneIdSource.ZoneIdSource = DataRepository.SecureObjectProvider.GetBySecureObjectId(page.ZoneId);

    if(page.ZoneIdSource.ZoneIdSource!=null)

    {

    page.ZoneIdSource.ZoneIdSource.ObjectPermissionCollection =

    DataRepository.ObjectPermissionProvider.GetBySecureObjectId(page.ZoneId);

    foreach (ObjectPermission permission in page.ZoneIdSource.ZoneIdSource.ObjectPermissionCollection)

    {

    permission.RoleIdSource = DataRepository.AspnetRolesProvider.GetByRoleId(permission.RoleId);

    }

    }

    }

    }

    -Jeff Martin C# MCSD
    • Post Points: 35
  • 01-03-2007 4:53 AM In reply to

    • madpeter
    • Top 150 Contributor
    • Joined on 03-10-2004
    • Posts 35
    • Points 815

    Re: Problem with deepload

    Hi

    I also have the same issue as Jeff with v464 (Stack Overflow when calling DeepLoad), v453 works fine.

    regards and happy new year
    Peter
    • Post Points: 35
  • 01-08-2007 4:06 PM In reply to

    Re: Problem with deepload

    The StackOverflow for nested M:M relationships has been resolved in SVN Rev 465, Thanks!

    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 60
  • 03-05-2007 12:24 PM In reply to

    • RyanHaney
    • Not Ranked
    • Joined on 02-28-2007
    • Posts 8
    • Points 100

    Re: Problem with deepload

    This is still not resolved.  I receive a stack overflow error when attempting to deep load.

    My database structure allows the following:
    Videos have Scenes
    Scenes have Stars
    Stars belong to Scenes

    When querying the database, the Video and Scene tables are joined via a mapping table that has VideoID and SceneID.  During the code gen process, NetTiers creates a collection off of the Videos entity called SceneCollection.  Each Scene has a collection called StarCollection, and each star has a collection called SceneFromSceneStars.  That hierarchy is fine if I don't include Stars in the type array in the DeepLoad call.  If I do, it attempts to load the scenes, then the stars, then the scenes that the stars belong to, and the stars in those scenes, etc. etc.  This results in a Stack Overflow due to never ending recursion.  I want to go deep, but only so many levels.  What do you recommend?  Will there be a fix for this?  Right now, I have to manually load the levels I want just as the first post above detailed.

    Anxious,

    Ryan

    Filed under:
    • Post Points: 35
  • 03-06-2007 1:57 AM In reply to

    • aurelius
    • Not Ranked
    • Joined on 02-20-2007
    • Posts 5
    • Points 85

    Re: Problem with deepload

    I agree with Ryan that this problem still exists, I'm facing it myself in the exact same situation he mentions (well, other entities of course ;-) )
    • Post Points: 35
  • 03-07-2007 12:37 PM In reply to

    • RyanHaney
    • Not Ranked
    • Joined on 02-28-2007
    • Posts 8
    • Points 100

    Re: Problem with deepload

    Robert,

    Is there something we are doing wrong, or is this indeed an issue?  Do you have a few ideas that you can throw out to fix this?

    Thanks!

    Ryan

    Filed under:
    • Post Points: 5
  • 03-09-2007 10:15 AM In reply to

    Re: Problem with deepload

    What version of the templates are you two using?

    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 03-09-2007 4:31 PM In reply to

    • RyanHaney
    • Not Ranked
    • Joined on 02-28-2007
    • Posts 8
    • Points 100

    Re: Problem with deepload

    From a previous message...

    I downloaded the latest version, which notes 2.0.1.511, regen'd my code, and it still doesn't work.  Since I know how many levels to load per type, it would be great if I could specify that, until then, I need to manually load each level.
    • Post Points: 5
  • 06-14-2007 5:00 PM In reply to

    • JJmartin
    • Top 25 Contributor
    • Joined on 05-22-2006
    • Phoenix, AZ
    • Posts 164
    • Points 3,275

    Re: Problem with deepload

    I am still having a problem with deepload and I really fail to understand how this is going on as it seems pretty basic to the DeepLoad functionality.  The problem isn't with overflows anymore but it is with getting the Deepload to Load TLists

    Its the same code I posted about in the top post but my object model goes

    WebPage<--Zone<-->SecureObject-->ObjectPermissions

    where

    <-- = Many to one

    <--> = One To One

    --> = One to many

    (zone can have many webpages, a zone has exactly one SecureObject, SecureObject can have many ObjectPermissions)

    TList<WebPage> _webPages = DataRepository.WebPageProvider.GetAll();

    Type[] types = new Type[] { typeof (Zone), typeof (ObjectPermission), typeof (SecureObject), typeof (TList<ObjectPermission>)};

    DataRepository.WebPageProvider.DeepLoad(_webPages, true, DeepLoadType.IncludeChildren, types);

    It seems fairly straightforward that I should be able to check the objectPermissions on each webpage after this code, but the ObjectPermissionList never fills.

    looking through the generated code: (debugging)

    there is code that looks like this: (in SecureObjectProviderBaseCore.generated.cs)

    if (CanDeepLoad(entity, "List<ObjectPermission>|ObjectPermissionCollection", deepLoadType, innerList))

    CanDeepLoad for the list ALWAYS returns false.... tracing further: (to EntityProviderBaseCore.Generated.cs)

    else if ( deepLoadType == DeepLoadType.IncludeChildren )
    {
    if (innerList.ContainsType(key) && !innerList.HasRun(entity, key))
    {

    Because innerList.ContainsType returns false ... trace deeper: (same file now in the DeepSession Class)

    if (SkipChildren && lkey.StartsWith("List<"))
    return false;

    Because SkipChildern is always false... why? because its set that way in the deepload  (backing out to ZoneProvdierBaseCore.generated.cs)

    if (deep && entity.ZoneIdSource != null)
    {
    innerList.SkipChildren =
    true;
    DataRepository.SecureObjectProvider.DeepLoad(transactionManager, entity.ZoneIdSource, deep, deepLoadType, childTypes, innerList);
    innerList.SkipChildren =
    false;
    }

    So the question is... why is the DeepSession.SkipChildren set to true each time recursive DeepLoads are called,  regardless of the deep or deepLoadType parameters?

     Please please let me know if I am doing something wrong...

    -Jeff Martin C# MCSD
    Filed under:
    • Post Points: 35
  • 06-25-2007 7:58 PM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 408
    • Points 10,260

    Re: Problem with deepload

    I think this is just a problem in your deepload type array

    Type[] types = new Type[] { typeof (Zone), typeof (ObjectPermission), typeof (SecureObject), typeof (TList<ObjectPermission>)};

    DataRepository.WebPageProvider.DeepLoad(_webPages, true, DeepLoadType.IncludeChildren, types);

    The type of the list should be "List" not TList.

    Type[] types = new Type[] { typeof (Zone), typeof (ObjectPermission), typeof (SecureObject), typeof (List<ObjectPermission>)};

    I am pretty sure this will solve your problem.

     Jeff

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 35
  • 08-01-2007 2:38 PM In reply to

    • costasz
    • Top 150 Contributor
    • Joined on 06-13-2007
    • Posts 28
    • Points 370

    Re: Problem with deepload

     I am getting StackOverflow Errors as well. In my case, my first load works ok. When I try to load again I get the stack overflows. My Object Graph looks like this

     

    ParentObjs

    -----ChildAObjects

    ----------AuditOfChildAObjects

    -----ChildBObjects

    ----------AuditOfChildObjects

    ----- AuditOfParentObjects

     

    My Call Stack looks like this:

          ChildAObject.MakeCopyOf(object x = {ParentObject}) Line 1059 + 0x14 bytes    C#
         ChildAObject.Copy() Line 1031 + 0x1d bytes    C#
         ChildAObject.Clone() Line 1045 + 0xa bytes    C#
         ListBase<ChildAObject>.MakeCopyOf(object x = {ChildAObject}) Line 577 + 0x14 bytes    C#
         TList<ChildAObject>.Copy() Line 125 + 0x39 bytes    C#
         TList<ChildAObject>.Clone() Line 113 + 0xa bytes    C#
         ParentObjectBAse.MakeCopyOf(object x = Count = Cannot evaluate expression because the current thread is in a stack overflow state.) Line 1065 + 0x14 bytes    C#
         ParentObjectBAse.Copy() Line 1040 + 0x19 bytes    C#
         ParentObjectBAse.Clone() Line 1051 + 0xa bytes    C#
         ChildAObject.MakeCopyOf(object x = {ParentObject}) Line 1059 + 0x14 bytes    C#
         ChildAObject.Copy() Line 1031 + 0x1d bytes    C#
         ChildAObject.Clone() Line 1045 + 0xa bytes    C#
         ListBase<ChildAObject>.MakeCopyOf(object x = {ChildAObject}) Line 577 + 0x14 bytes    C#
         TList<ChildAObject>.Copy() Line 125 + 0x39 bytes    C#
         TList<ChildAObject>.Clone() Line 113 + 0xa bytes    C#
         ParentObjectBAse.MakeCopyOf(object x = Count = Cannot evaluate expression because the current thread is in a stack overflow state.) Line 1065 + 0x14 bytes    C#
         ParentObjectBAse.Copy() Line 1040 + 0x19 bytes    C#
         ParentObjectBAse.Clone() Line 1051 + 0xa bytes    C#
         ChildAObject.MakeCopyOf(object x = {ParentObject}) Line 1059 + 0x14 bytes    C#
         ChildAObject.Copy() Line 1031 + 0x1d bytes    C#
         ChildAObject.Clone() Line 1045 + 0xa bytes    C#
         ListBase<ChildAObject>.MakeCopyOf(object x = {ChildAObject}) Line 577 + 0x14 bytes    C#
         TList<ChildAObject>.Copy() Line 125 + 0x39 bytes    C#
         TList<ChildAObject>.Clone() Line 113 + 0xa bytes    C#
         ParentObjectBAse.MakeCopyOf(object x = Count = Cannot evaluate expression because the current thread is in a stack overflow state.) Line 1065 + 0x14 bytes    C#
         ParentObjectBAse.Copy() Line 1040 + 0x19 bytes    C#
         ParentObjectBAse.Clone() Line 1051 + 0xa bytes    C#
         ChildAObject.MakeCopyOf(object x = {ParentObject}) Line 1059 + 0x14 bytes    C#
         ChildAObject.Copy() Line 1031 + 0x1d bytes    C#
         ChildAObject.Clone() Line 1045 + 0xa bytes    C#
         ListBase<ChildAObject>.MakeCopyOf(object x = {ChildAObject}) Line 577 + 0x14 bytes    C#
         TList<ChildAObject>.Copy() Line 125 + 0x39 bytes    C#
         TList<ChildAObject>.Clone() Line 113 + 0xa bytes    C#
         ParentObjectBAse.MakeCopyOf(object x = Count = Cannot evaluate expression because the current thread is in a stack overflow state.) Line 1065 + 0x14 bytes    C#
         ParentObjectBAse.Copy() Line 1040 + 0x19 bytes    C#
         ParentObjectBAse.Clone() Line 1051 + 0xa bytes    C#
         ChildAObject.MakeCopyOf(object x = {ParentObject}) Line 1059 + 0x14 bytes    C#
         ChildAObject.Copy() Line 1031 + 0x1d bytes    C#
         ChildAObject.Clone() Line 1045 + 0xa bytes    C#
         ListBase<ChildAObject>.MakeCopyOf(object x = {ChildAObject}) Line 577 + 0x14 bytes    C#
         TList<ChildAObject>.Copy() Line 125 + 0x39 bytes    C#
         TList<ChildAObject>.Clone() Line 113 + 0xa bytes    C#
         ParentObjectBAse.MakeCopyOf(object x = Count = Cannot evaluate expression because the current thread is in a stack overflow state.) Line 1065 + 0x14 bytes    C#
         ParentObjectBAse.Copy() Line 1040 + 0x19 bytes    C#
         ParentObjectBAse.Clone() Line 1051 + 0xa bytes    C#
         ChildAObject.MakeCopyOf(object x = {ParentObject}) Line 1059 + 0x14 bytes    C#
         ChildAObject.Copy() Line 1031 + 0x1d bytes    C#
         ChildAObject.Clone() Line 1045 + 0xa bytes    C#
         ListBase<ChildAObject>.MakeCopyOf(object x = {ChildAObject}) Line 577 + 0x14 bytes    C#
         TList<ChildAObject>.Copy() Line 125 + 0x39 bytes    C#
         TList<ChildAObject>.Clone() Line 113 + 0xa bytes    C#
         ParentObjectBAse.MakeCopyOf(object x = Count = Cannot evaluate expression because the current thread is in a stack overflow state.) Line 1065 + 0x14 bytes    C#
         ParentObjectBAse.Copy() Line 1040 + 0x19 bytes    C#
         ParentObjectBAse.Clone() Line 1051 + 0xa bytes    C#
         ChildAObject.MakeCopyOf(object x = {ParentObject}) Line 1059 + 0x14 bytes    C#
         ChildAObject.Copy() Line 1031 + 0x1d bytes    C#
         ChildAObject.Clone() Line 1045 + 0xa bytes    C#
         ListBase<ChildAObject>.MakeCopyOf(object x = {ChildAObject}) Line 577 + 0x14 bytes    C#
         TList<ChildAObject>.Copy() Line 125 + 0x39 bytes    C#
         TList<ChildAObject>.Clone() Line 113 + 0xa bytes    C#
         ParentObjectBAse.MakeCopyOf(object x = Count = Cannot evaluate expression because the current thread is in a stack overflow state.) Line 1065 + 0x14 bytes    C#
         ParentObjectBAse.Copy() Line 1040 + 0x19 bytes    C#
         ParentObjectBAse.Clone() Line 1051 + 0xa bytes    C#

     

                  

          

                  


     

    • Post Points: 5
  • 08-01-2007 2:49 PM In reply to

    • costasz
    • Top 150 Contributor
    • Joined on 06-13-2007
    • Posts 28
    • Points 370

    Re: Problem with deepload

    Well, it seems that the Loading is NOT the culprit. The List returned by the service is fine. This list is attached (through a BindingSource) to a DevExpressGrid. When the DataSource is set to the list, it seems that the IEditable  Methods are called which starts the trip towards the StackOverflowException. I am using 2.2 Ver 603. I will try an earlier version to see if it's something that was always broken or if it's a recent bug.

     

     

     

    • Post Points: 5
  • 08-01-2007 3:28 PM In reply to

    • costasz
    • Top 150 Contributor
    • Joined on 06-13-2007
    • Posts 28
    • Points 370

    Re: Problem with deepload

     Well, it happens in older versions as well.

     

    It seems that the Grid is calling this method when the datasource property is assigned.

     

        void IEditableObject.BeginEdit()
            {
                //Console.WriteLine("Start BeginEdit");
                if (!inTxn)
                {
                    this.backupData = this.entityData.Clone() as ParentObjectData

     

    That line of code starts the whole stackoverflow problem. It never comes out of this. 

     

    ;

    • Post Points: 5
Page 1 of 1 (14 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems