Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Inform GM on API crash

Hello everyone, Sometimes one of my API scripts crashes but since this happens only soo irregular I'm having a hard time getting to the base of it with my usual troubleshooting. Is it possible to have an event fire when the API sandbox is crashing? I know there is probably no way to do this since the API is crashing but maybe there is a way to implement something like a "Dying-Gasp" Signal? Like hooking the Exception handler or something?
1540210501
Ziechael
Forum Champion
Sheet Author
API Scripter
There are suggestions for a chat notification sent on crash etc but in the interim The Aaron did write an API heartbeat for easy visual notification.
1540212917
The Aaron
Pro
API Scripter
Also, if you post what error you’re getting when it crashes, and what scripts you’re using, we can maybe point you to some possible causes.  If you know which script is crashing, particularly if you’re developing it, there are some things you can do to try and catch the exception. There are a few cases where the crash happens later because of bad data. If you see an error about NaN abs Firebase, it’s a little harder to track down, but not impossible. 
The error says "Possible infinite loop detected", which unfortunately doesn't give a strack trace if I'm remembering correctly (possibly because the sandbox is killed by a governor process or something). Since this happens only sporadic and mostly only when my players are in the game I haven't taken the time to disable everything for a session and see which script is causing this or when the error is returning.
1540214563
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
What scripts do you have installed? A likely culprit might be spottable.
I've actually been getting the same Florian. Running PFCS, Marching Order, Easy Experience, splitArgs, storeCommands, shell, ChatSetAttr, cron, TokenMod, and then 5 customs. Got any overlap?
1540215234
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
It's not potential overlap that could be a problem. When are you getting this happening Noon and Florian?
Good idea noon, here are my scripts. - GroupInitiative - Bump - Torch - Vector Math - Path Math - MatrixMath - DryErase.js - RollStats.js - Companion.js: Version of the Pathfinder Companion Script with the version check removed - Token Collisions - ChatSetAttr - DLEllipseDrawer - Roll20 Audio Master - Path Splitter - centerSmallTokens.js - TokenMod - StatusInfo.js - CombatTracker - LazyExperience - DeathTracker Things I can rule out: - LazyCalendar.js: I only installed this when the error was already happening. I highlighted the obvious overlap and the PFCS seems like a good candidate for looking into because all the other scripts we're overlapping normally don't do anything unless called specifically. I'm not 100% certain but I think I would have noticed if it always happens after I run a specific API command or macro that makes a call. But PCFS on the other hand does a lot of things on its own (most important for me is the mook-numbering) and this might be a pointer.
Scott, that's the problem - I haven't found the thing I'll do that causes the issue. I only notice it when its too late to make out what has caused it.
1540228998

Edited 1540234221
Yeah. Generally if I fall asleep with the VTT open or was looking away. Just sporadic. Never even enabled mook numbering over here. And just turned off damage/ effect listener even though it is not implemented. From the changelog and my suspicion I'd say it is probably to do with the buff round tracking. Maybe we have some garbage value from deleted characters or something. The API has crashed caught an error more than once just switching turns but I always figured it was the fault of one of my things. It was. I'm bad. I'll keep an eye out. There was a comment about how the infinite loop detection worked a couple years ago. I can't imagine it changed since. It could be chrome putting the tab to sleep or something to that effect. Not even related to our scripts but our habit of spending lots of hours in game...
1540249134

Edited 1540249183
The Aaron
Pro
API Scripter
The possible infinite loop occurs when a script tries to do "too much" when it's called.  It usually occurs when there is some operation that loads "all the things" and tries to operate on them.   Things like "Get all the Tokens and set them with status Blue if they have more than 15 AC" or some such.  The important aspect is the open ended size of the set of things to operate on.  Scripts are often tested when there are only a few things (say, 20-100 tokens), without the realization that there might be 1000+ in a real game.  What works fine for only 50 tokens will die a fiery death with 500.  Look for scripts that perform some action for you when you do something else, such as updating something when you move a token, or change an attribute, or add a graphic.  If you look at the code, you can look for places that a findObjs() is called and then immediately iterated over to do some set of operations.  ( or a filterObjs() or ( shudder ) allObjs() ) 
1540251290

Edited 1540251339
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, I'm thinking this might be caused by PFC. It has several places where it works on several things. It should have been done in such a way that it won't cause an infinite loop, but it is certainly possible especially since it is a commonality between the games reporting the issue.
1540253084

Edited 1540253094
vÍnce
Pro
Sheet Author
Scott C. said: Yep, I'm thinking this might be caused by PFC. It has several places where it works on several things. It should have been done in such a way that it won't cause an infinite loop, but it is certainly possible especially since it is a commonality between the games reporting the issue. Does that mean PFC v2 is finally being released? ;-P
1540257578

Edited 1540257666
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Heh, still working on it. So many things on my to do list.