Eunomiac said: GiGs said: aisforanagrams said: i basically just restart the sandbox before every session. unfortunately, i've found that "API" codes are generally brittle and cause frequent crash. it's partly also the messy way in which roll20 implements their "API" system. The problem is that the roll20 environment makes it very hard to identify which of your scripts are causing crashes, and everyone's environment is unique - which means if you're running a lot of scripts, you have to do some error testing yourself to find which script is bugging out, and that can be hard work and most people don't know how to do it. This is pretty much the boat I'm in. Usually I can debug scripts myself with some effort --- disabling scripts, commenting out large chunks, log messages, basically all the standard tricks. Do you have any advice for me in this particular instance, where the combination of (A) an unhelpful error message, (B) my inability to reliably reproduce the error, and (C) the fact that would take several days to test the effect any changes (i.e. disabling scripts/functions) might have, means I can't use any of the methods I typically rely on? Is this a matter for Roll20 Support, do you think? I would normally say that Roll20 Support wont be able to help you because its not actually a
problem with roll20's basic features, it's the content you have created
in roll20. They can't debug your code for you. That said, the error message you posted at the start seems to point to roll20 code, nit yours, if I'm reading it right, so maybe contacting them might help. I'm not sure how much help I can personally suggest - a quick glance at your code suggests you have decent code skills (likely better than mine!). So you're at the stage of just doing the hard work - trying to break you code down into small manageable chunks, and testing until you find what breaks. One thing you can do as well as logging, is add whispered sendChat status reports- maybe go through and add a lot of these, at points where processes are happening. It'll add a lot of spam to your chat log, but when the code crashes, they'll stop being sent. So you might be able to trace the process that led up to the crash. Knowing when they've stopped might help you figure out what is causing the error. With a codebase as big as this, there is no easy solution. With intermittent errors, you need to do some serious debugging, and the amount of your script code makes that a gargantuan job. One thing that puzzles me is that you are coming back and finding the API disabled. Does this only happen when you are out of a session, or does it happen during sessions too? If the latter, my guess is it's happening when someone else logs into the campaign and does something with their characters. Practical suggestion: I'd try to sort out which scripts I can do without, and disable them, and just keep playing for a while and see if the crash recurs. If it does recur, you knoose scripts probably are safe, and you can use the "disable half" method of debugging for the rest. Essentially, disable half your scripts. See if the error recurs. If not, reenable them, and disable the other half. Repeat until the error recurs. When it recurs you know that the error is in that half of your scripts. Make a note of those scripts, then disable half of them. Then the other half. And keep repeating till you get the error again. Then you know the error is in that half of the scripts (now a quarter), and halve them again and repeat. Eventually (if its a single script problem) you'll narrow down to one script which has the problem, The tricky part is that some errors are caused by interactions between more than one script - but if your code in each script is self contained this will eventually pinpoint the source of the error. If you don't want to disable scripts during a session, disable them after a session ends and reenable them at the start of the next, and just hope whatever is causing the crashes while you aren't playing recurs. If you do this you will have to cycle through each half until the error happens - it may take a while, since the scripts wont be being called as often when people aren't playing. Anyway, it's going to be a long thankless process. Good luck!