#10963: More functorial constructions
-------------------------------------+-------------------------------------
       Reporter:  nthiery            |        Owner:  stumpc5
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.1
      Component:  categories         |   Resolution:
       Keywords:  days54             |    Merged in:
        Authors:  Nicolas M. Thiéry  |    Reviewers:  Simon King, Frédéric
Report Upstream:  N/A                |  Chapoton
         Branch:                     |  Work issues:  Detect and fix
  public/ticket/10963                |  Heisenbugs
   Dependencies:  #11224, #8327,     |       Commit:
  #10193, #12895, #14516, #14722,    |  5ccf253b17c151d8e773037ac634a64f84f03075
  #13589, #14471, #15069, #15094,    |     Stopgaps:
  #11688, #13394, #15150, #15506     |
-------------------------------------+-------------------------------------

Comment (by nbruin):

 Would it make sense to put this debugging on a different ticket? The
 length of
 this one makes working on it excruciating (especially tickets with a lot
 of
 comments seem particularly slow with trac) and the debugging involved in
 this is
 a bit of a side-issue.

 Since it is a python recursion bug, we should probably look at the ".py"
 files
 involved, so I did a grep:
 {{{
 $ grep "^#.*py:[0-9]*$" crash_functorial_constructions.log
 #24 0x00007fee3aa07580 in __classget__() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:507
 #38 0x00007fee3aa07580 in base_category_class_and_axiom() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:243
 #47 0x00007fee3aa07580 in _base_category_class_and_axiom() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:381
 #57 0x00007fee3aa07580 in axiom_of_nested_class() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:281
 #66 0x00007fee3aa07580 in __classget__() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:507
 ...
 #710 0x00007fee3aa07580 in base_category_class_and_axiom() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:243
 #719 0x00007fee3aa07580 in _base_category_class_and_axiom() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:381
 #729 0x00007fee3aa07580 in axiom_of_nested_class() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:281
 #738 0x00007fee3aa07580 in __classget__() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:507
 ...
 #2768 0x00007fee3aa07580 in base_category_class_and_axiom() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:243
 #2777 0x00007fee3aa07580 in _base_category_class_and_axiom() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:381
 #2787 0x00007fee3aa07580 in axiom_of_nested_class() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:281
 #2796 0x00007fee3aa07580 in __classget__() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category_with_axiom.py:507
 #2809 0x00007fee3aa07580 in extra_super_categories() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/sets_cat.py:1826
 #2812 0x00007fee3aa07580 in super_categories() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/covariant_functorial_construction.py:399
 #2815 0x00007fee3aa07580 in _super_categories() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category.py:1015
 #2823 0x00007fee3aa07580 in _all_super_categories() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category.py:885
 #2831 0x00007fee3aa07580 in _super_categories_for_classes() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category.py:1040
 #2839 0x00007fee3aa07580 in _make_named_class() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category.py:1246
 #2843 0x00007fee3aa07580 in subcategory_class() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category.py:1290
 #2851 0x00007fee3aa07580 in __init__() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category.py:504
 #2856 0x00007fee3aa07580 in __init__() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/covariant_functorial_construction.py:355
 #2867 0x00007fee3aa07580 in __classcall__() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/structure/unique_representation.py:1021
 #2875 0x00007fee3aa07580 in __classcall__() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/category.py:465
 #2883 0x00007fee3aa07580 in category_of() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/covariant_functorial_construction.py:269
 ...
 #3180 0x00007fee3aa07580 in WithRealizations() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/with_realizations.py:181
 #3183 0x00007fee3aa07580 in __init__() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/combinat/sf/sf.py:767
 #3194 0x00007fee3aa07580 in __classcall__() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/structure/unique_representation.py:1021
 #3206 0x00007fee3aa07580 in __init__() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/combinat/species/generating_series.py:327
 #3217 0x00007fee3aa07580 in CycleIndexSeriesRing() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/combinat/species/generating_series.py:314
 ...
 }}}
 So it would seem that the creation of a `SymmetricFunctions` object leads
 via a
 long chain of `WithRealizations` calls to the creation of a category
 (frame
 `#2851`) which calls `extra_super_categories` (frame `#2809`) and then
 goes off
 to a long chain of calls involving `axiom_of_nested_class` and
 `base_category_class_and_axiom` (66 deep apparently)

 What probably causes the eventual error is that building such a deep call
 chain
 requires memory and thus can trigger a garbage collection, at which point
 there
 may be some extra room required on top of the python call stack to execute
 the
 various weakref callbacks. Apparently that room isn't there.

 66 calls is suspiciously deep, but perhaps symmetric functions
 realizations are
 indeed extremely complicated. Let's look at the relevant frames:

 {{{
 #2807 0x00007fee2dcdcd6d in
 __pyx_tp_descr_get_4sage_4misc_11lazy_import_LazyImport() at
 /home/vbraun/Code/sage/src/sage/misc/lazy_import.c:7252
 #2808 0x00007fee3a9a2c00 in _PyObject_GenericGetAttrWithDict() at
 
/home/vbraun/Code/sage/local/var/tmp/sage/build/python-2.7.5.p1/src/Objects/object.c:1439
 #2809 0x00007fee3aa07580 in extra_super_categories() at
 /home/vbraun/Code/sage/local/lib/python2.7/site-
 packages/sage/categories/sets_cat.py:1826
 > 1826                return [Sets().Facade()]
 }}}

 There seems to be a lazy import involved, and indeed, there seems to be a
 cycle
 of 24 frames that keeps repeating from this point on. So one hypothesis
 might be
 that somehow some lazy import resolution doesn't go right, which confuses
 the
 `base_category_class_and_axiom` code, which them keeps recursing. Perhaps
 a
 script like this rings some bells with the persons who are familiar with
 the
 code?

--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:242>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to