On closer inspection, it seems that snapshot-set acts up on any sort of circular references.
I created a self-contained test case which demonstrates the failure, using two objects with mutual references. Looking at the code, my guess is that since an object is saved before it is marked as touched, any circular references are followed even if that object was saved already. I tried the trivial fix of moving the touch call to before the save, which seems to make my test case work. (However, I haven't extensively tested on anything else, so you may want to run your own tests before committing the change.) Both the test and the patch are attached. On Fri, Mar 20, 2009 at 6:07 AM, Ian Eslick <esl...@media.mit.edu> wrote: > The key question is why save-snapshot-object doesn't catch the fact > that your Hero objects have been 'touched'. What is happening in the > touched vector in the snapshot set after each iteration? There isn't > too much code; I'd recommend compiling with full debug, putting a > break in save-proxy-object and save-snapshot-set and inspecting the > values after each step to see what state isn't being recorded that > would stop this recursion. > > Ian > > On Mar 20, 2009, at 12:56 AM, Elliott Slaughter wrote: > > > On Wed, Mar 18, 2009 at 9:18 PM, Ian Eslick <esl...@media.mit.edu> > > wrote: > > You need to implement register-object for your metaclass, only > > standard classes are 'registered' or kept in the ID table. > > > > Instances of my metaclass still inherit from standard-object, and > > are thus registered by the existing register-object methods. I added > > some print statements to register-object, and the IDs do seem to get > > registered properly (i.e. it returns the same id for the same > > instance over many calls). > > > > (And the stack overflow doesn't occur when I register my objects, > > but afterwards when I call snapshot.) > > > > Here is a sample of the stack trace, in case it is helpful. Again, > > any assistance would be appreciated. > > > > 3070: (ELEPHANT::REIFY-VALUE #<HERO {23EDF561}> #<SNAPSHOT-SET oid:2>) > > 3071: (ELEPHANT::SAVE-PROXY-OBJECT > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3072: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1534 > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3073: (ELEPHANT::REIFY-VALUE #<HERO-BODY {23EDF551}> #<SNAPSHOT-SET > > oid:2>) > > 3074: (ELEPHANT::SAVE-PROXY-OBJECT #<HERO {23EDF561}> #<SNAPSHOT-SET > > oid:2>) > > 3075: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1532 > > #<HERO {23EDF561}> > > #<SNAPSHOT-SET oid:2>) > > 3076: (ELEPHANT::REIFY-VALUE #<HERO {23EDF561}> #<SNAPSHOT-SET oid:2>) > > 3077: (ELEPHANT::SAVE-PROXY-OBJECT > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3078: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1534 > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3079: (ELEPHANT::REIFY-VALUE #<HERO-BODY {23EDF551}> #<SNAPSHOT-SET > > oid:2>) > > 3080: (ELEPHANT::SAVE-PROXY-OBJECT #<HERO {23EDF561}> #<SNAPSHOT-SET > > oid:2>) > > 3081: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1532 > > #<HERO {23EDF561}> > > #<SNAPSHOT-SET oid:2>) > > 3082: (ELEPHANT::REIFY-VALUE #<HERO {23EDF561}> #<SNAPSHOT-SET oid:2>) > > 3083: (ELEPHANT::SAVE-PROXY-OBJECT > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3084: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1534 > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3085: (ELEPHANT::REIFY-VALUE #<HERO-BODY {23EDF551}> #<SNAPSHOT-SET > > oid:2>) > > 3086: (ELEPHANT::SAVE-PROXY-OBJECT #<HERO {23EDF561}> #<SNAPSHOT-SET > > oid:2>) > > 3087: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1532 > > #<HERO {23EDF561}> > > #<SNAPSHOT-SET oid:2>) > > 3088: (ELEPHANT::REIFY-VALUE #<HERO {23EDF561}> #<SNAPSHOT-SET oid:2>) > > 3089: (ELEPHANT::SAVE-PROXY-OBJECT > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3090: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1534 > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3091: (ELEPHANT::REIFY-VALUE #<HERO-BODY {23EDF551}> #<SNAPSHOT-SET > > oid:2>) > > 3092: (ELEPHANT::SAVE-PROXY-OBJECT #<HERO {23EDF561}> #<SNAPSHOT-SET > > oid:2>) > > 3093: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1532 > > #<HERO {23EDF561}> > > #<SNAPSHOT-SET oid:2>) > > 3094: (ELEPHANT::REIFY-VALUE #<HERO {23EDF561}> #<SNAPSHOT-SET oid:2>) > > 3095: (ELEPHANT::SAVE-PROXY-OBJECT > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3096: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1534 > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3097: (ELEPHANT::REIFY-VALUE #<HERO-BODY {23EDF551}> #<SNAPSHOT-SET > > oid:2>) > > 3098: (ELEPHANT::SAVE-PROXY-OBJECT #<HERO {23EDF561}> #<SNAPSHOT-SET > > oid:2>) > > 3099: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1532 > > #<HERO {23EDF561}> > > #<SNAPSHOT-SET oid:2>) > > 3100: (ELEPHANT::REIFY-VALUE #<HERO {23EDF561}> #<SNAPSHOT-SET oid:2>) > > 3101: (ELEPHANT::SAVE-PROXY-OBJECT > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3102: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1534 > > #<HERO-BODY {23EDF551}> > > #<SNAPSHOT-SET oid:2>) > > 3103: (ELEPHANT::REIFY-VALUE #<HERO-BODY {23EDF551}> #<SNAPSHOT-SET > > oid:2>) > > 3104: (ELEPHANT::SAVE-PROXY-OBJECT #<HERO {23EDF561}> #<SNAPSHOT-SET > > oid:2>) > > 3105: (ELEPHANT::SAVE-SNAPSHOT-OBJECT > > 1532 > > #<HERO {23EDF561}> > > #<SNAPSHOT-SET oid:2>) > > > > On Mar 18, 2009, at 11:31 PM, Elliott Slaughter wrote: > > > > > Hi, > > > > > > I have been exploring using snapshot-set in my application, and > > > noticed a couple of issues. > > > > > > First, snapshot set doesn't compile under SBCL since the cache > > > initform includes > > > > > > (make-hash-table :weak-keys t) > > > > > > and SBCL doesn't recognize the :weak-keys argument. This is easily > > > enough fixed (in the short term) by commenting this out; in the long > > > term it may be useful to use trivial-garbage for weak hash-tables. > > > > > > > > > Second, after hacking snapshot-set into my application, and > > > following a pause of about 30 seconds, > > > > > > debugger invoked on a SB-KERNEL::CONTROL-STACK-EXHAUSTED: > > > Control stack exhausted (no more space for function call frames). > > > This is probably due to heavily nested or infinitely recursive > > > function > > > calls, or a tail call that SBCL cannot or has not optimized away. > > > > > > This is on a data set of roughly 2000 objects. The data consists of > > > a hash-table from symbols to hash-tables, which map integers to > > > instances of a custom metaclass. The data contains circular > > > references. (I don't know how complete snapshot-set is, so I don't > > > know if any of these are potentially problematic.) > > > > > > I would include the backtrace except it is over 30,000 calls long. I > > > can give the code that calls snapshot-set if that would be helpful. > > > > > > > > > Any advice or assistance would be appreciated. Thanks. > > > > > > -- > > > Elliott Slaughter > > > > > > "Any road followed precisely to its end leads precisely nowhere." - > > > Frank Herbert > > > _______________________________________________ > > > elephant-devel site list > > > elephant-devel@common-lisp.net > > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > > > > _______________________________________________ > > elephant-devel site list > > elephant-devel@common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > > > > > > -- > > Elliott Slaughter > > > > "Any road followed precisely to its end leads precisely nowhere." - > > Frank Herbert > > _______________________________________________ > > elephant-devel site list > > elephant-devel@common-lisp.net > > http://common-lisp.net/mailman/listinfo/elephant-devel > > > _______________________________________________ > elephant-devel site list > elephant-devel@common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel > -- Elliott Slaughter "Any road followed precisely to its end leads precisely nowhere." - Frank Herbert
circular_snapshot_set.lisp
Description: Binary data
fixed-circularity-bug-in-snapshot-sets_.dpatch
Description: Binary data
_______________________________________________ elephant-devel site list elephant-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel