run_cascading_callbacks results in 'stack level too deep' for 1..N embedded relation with > 1000 documents

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • 2.4.7
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I have a document WorkItem which 1..N embeds another document WorkItemUpdate. This relation has cascade_callbacks set to true. Some of WorkItem instances embed more than 1000 instances of WorkItemUpdate. Whenever I try to load such document, e.g. WorkItem.find("id"), I get a SystemStackError: stack level too deep with single line of trace:

      activesupport (3.1.4) lib/active_support/callbacks.rb:396

      As far as I was able to research this brought me to the Mongoid::Callbacks.run_cascading_callbacks method in lib/mongoid/callbacks.rb, which recrusively invokes itself for the array embedded documents except the last one.

      Does this mean that cascade_callback is not meant to be used with large relations of embedded documents? Or this bug?

              Assignee:
              Durran Jordan
              Reporter:
              antonlitvinenko
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: