Reproduction Steps
Run code that triggers the maximum re-entrancy error such as the following:
local function f(i)
if i == 20 then
print("done!")
else
task.defer(f, i + 1)
end
end
f(1)
Expected Behavior
I expect Maximum re-entrancy depth (10) exceeded to include a stack trace so I know what code is causing the issue.
Tracking down the cause without a stack trace is a massive pain and leaves me wondering if the issue is even in my code.
Luckily, I was doing this in an isolated environment for running tests, so I just disabled each test one-by-one until I found the cause. Can’t say I’ll always be so lucky! If I encountered this on a live game with a massive codebase it would be practically impossible to find the cause!
Actual Behavior Maximum re-entrancy depth (10) exceeded does not include a stack trace.
Workaround
In some cases there is no workaround for this issue. For example, finding the cause of this error would be impossible in large codebases running into obscure edge-cases in live games.
Issue Area: Engine Issue Type: Other Impact: High Frequency: Sometimes Date First Experienced: 2022-03-03 00:03:00 (-06:00) Date Last Experienced: 2022-03-03 00:03:00 (-06:00)
A better message is critical here because using the debugger will prevent the re-entrancy bug from occurring—a Heisenbug!
I was searching for recursion in my code when that wasn’t the problem at all, just that function 1 deferred 2, 2 deferred 3, and so on, where the same function was never deferred twice. I’d much rather see something like “task deferring repeatedly deferred more tasks 10 times”.
Hey everyone, so sorry for the late response here. We’re working hard to improve our responsiveness to bug reports. Are you still experiencing this issue? If so, please let me know, and we’ll get this routed to the right people at Roblox.
Is it still possible to reproduce this issue with the given example code (or any code)? Currently, the deferral re-entrancy limit is 80 and there is a stack trace provided in case that limit is exceeded.