Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Error: Push(): stack overflow

    Scheduled Pinned Locked Moved
    General Discussion
    3
    7
    368
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Diamondbackundefined
      Diamondback
      last edited by

      Hello,

      I'm currently running into a stack overflow error and needs some help to debug it.
      I'm using quite a few nested macros (not recursive as far as I can tell), and it looks like I'm using one level of nesting too much...
      What's the currently supported max nesting depth for calling macros on Duet 2 Wifi?

      chrishammundefined 1 Reply Last reply Reply Quote 0
      • chrishammundefined
        chrishamm administrators @Diamondback
        last edited by chrishamm

        @diamondback The limit for stack depths in RRF is currently 7 but there is always a default stack entry on every G-code channel which reduces the maximum nesting depth to 6 files/push invocations.

        Note that this limitation does not affect the maximum indentation in macro or job files.

        PS: In versions older than 3.01 the maximum stack depth is 5.

        Duet software engineer

        Diamondbackundefined 1 Reply Last reply Reply Quote 1
        • Diamondbackundefined
          Diamondback @chrishamm
          last edited by

          @chrishamm Thanks, that seems to be the issue then. I guess raising this is not super trivial?

          chrishammundefined 1 Reply Last reply Reply Quote 0
          • chrishammundefined
            chrishamm administrators @Diamondback
            last edited by

            @diamondback Changing it in the source code should not be difficult but it might not be higher because of the memory limitations we have on the Duet 2 series. What seems like a good limit for your purposes?

            Duet software engineer

            Diamondbackundefined 1 Reply Last reply Reply Quote 1
            • Diamondbackundefined
              Diamondback @chrishamm
              last edited by

              @chrishamm In the current use case (PA tuning for different combinations of filaments, tools and nozzle sizes), I use a chain of parametric macros to further refine the settings for the Marlin PA test, depending on which tool is tested, which filament is currently in there and what nozzle is installed, it finally runs different test gcode.
              In this specific case I was using literally one too many levels of nesting overall (it's a toolchanger so even simple tasks like homing use a few levels).

              IF it can be raised without affecting anything else, that would certainly be appreciated, even if just by 1. However, it's probably a fairly niche case considering I couldn't find any previous reports of this via the search.

              dc42undefined 1 Reply Last reply Reply Quote 0
              • dc42undefined
                dc42 administrators @Diamondback
                last edited by

                @diamondback I have increased the maximum stack depth from 7 to 10 in RRF 3.4.0beta6.

                The reason for having a limit is to gracefully handle the case of a recursive macro.

                Duet WiFi hardware designer and firmware engineer
                Please do not ask me for Duet support via PM or email, use the forum
                http://www.escher3d.com, https://miscsolutions.wordpress.com

                Diamondbackundefined 1 Reply Last reply Reply Quote 1
                • Diamondbackundefined
                  Diamondback @dc42
                  last edited by

                  @dc42 Awesome, thanks a lot! 👍

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA