Error: Push(): stack overflow
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?
@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.
@chrishamm Thanks, that seems to be the issue then. I guess raising this is not super trivial?
@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?
@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.
@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.
@dc42 Awesome, thanks a lot!