EDIT: The cause of the new warning is now clear but a resultant question remains.
I had a script that was calling itself (in a controlled manner ) which never used to give a warning or be a problem. Now I have removed the recursion but still get the warning.
I’m getting a new warning a lot in my logs.
I think I might know why but has it been documented?
(‘Notify’ is the name of my script)
Notify: Disallowed recursion detected
17:59:29 – (WARNING) Scripts - message first occurred at 16 April 2022, 07:57:17 and shows up 20 times
And more importantly I believe (but cannot yet prove) that whatever is causing it is doing more than creating a warning because my ‘suspect’ script is behaving strangely.
Maybe it was undefined prior (kinda worked, but not really intended to and no one really thought about it) and they explicitly made it unsupported now. Supporting recursion properly is not trivial and needs strict resource control, maximum recursion depth, etc. Misbehaving recursive code can go nuclear very easily without proper control. Maybe they didn’t want to add all this complexity for a feature that would be very rarely used.
You can always write your script in Python directly (with recursion if you want) and call it from HA.
Yeah, I agree with all that. And I have no problem with the change, in fact my recursion whilst intentional was really something I should have avoided so I’m glad it has been pointed out.
It just would have been good to have read about the ‘new’ warning/error in the release notes.
After updating to 2024.4.4 I started getting this with a script that had been working fine several times a day for more than a year. I don’t feel like decomposing it for debugging for the moment. However, looks like the problem is due to the mode being queued and the script being called in two parallel actions. One of the calls fails with Disallowed recursion detected, which I guessed meant that a queued script cannot be called in parallel (thus cheating the queue) but I couldn’t prove it with a little test script. The test is set to queued yet two parallel runs execute fine.
The original script does not call itself or any other script, so not sure what’s up. In any case, now I just call in it series instead.