Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Debugging scripts that just stop working after a while / Preserving data

Mewcenary Bernstein
Registered User
Join date: 18 Jul 2005
Posts: 9
07-26-2005 07:25
I've written a script which makes a note of whoever comes within a set range. It makes a note of their name, and keeps track of how long they are around for.

It uses a List to store the information.

After a while, the script simply stops running. It becomes unresponsive to commands. It is still showing as "Running" if I look at it, and there are no error messages.

Any suggestions regarding how to proceed? Do run-time errors get IMd if the owner is not logged on when a script fails for some reason?

I guess it wouldn't be too bad if the script could remember the information it was tracking if it was restarted, but there doesn't appear to be any way for the script to dump memory to an object (like a Notecard). Or is therer?
Khamon Fate
fategardens.net
Join date: 21 Nov 2003
Posts: 4,177
07-26-2005 07:33
It might be running out of memory. Add a debug function that tells you the amount of remaining storage available so you can monitor that value as the list lengthens. You'll be able to test it then and see if you're dealing with too much data for it to handle.

If that's the case, you might have the script check the string length before it adds a name and shift off the first few if it's over a given size. It can add to a counter the number of names it deletes so you will have a running total and a list of the most recent avs to come in range.
_____________________
Visit the Fate Gardens Website @ fategardens.net
Frans Charming
You only need one Frans
Join date: 28 Jan 2005
Posts: 1,847
07-26-2005 08:02
You could also test, at how entries it goes dead. And then make it so that just before it sends you a email with the complete list and then empty the list in the script.
_____________________
Mewcenary Bernstein
Registered User
Join date: 18 Jul 2005
Posts: 9
07-26-2005 08:14
From: Khamon Fate
It might be running out of memory. Add a debug function that tells you the amount of remaining storage available so you can monitor that value as the list lengthens. You'll be able to test it then and see if you're dealing with too much data for it to handle.

If that's the case, you might have the script check the string length before it adds a name and shift off the first few if it's over a given size. It can add to a counter the number of names it deletes so you will have a running total and a list of the most recent avs to come in range.
I had not considered this possibility as I was not aware of how much memory each script was allowed to use. Now I know!

It is a shame that llGetFreeMemory() is considered bugged. What I am doing for now is restricting the system to only record the x most recent avatars, as per your suggestion. I'm also using llSetText() so if the script does freeze again, I will know the last reported amount of memory free. But this may of course be inaccurate.
Mewcenary Bernstein
Registered User
Join date: 18 Jul 2005
Posts: 9
07-26-2005 08:15
From: Frans Charming
You could also test, at how entries it goes dead. And then make it so that just before it sends you a email with the complete list and then empty the list in the script.
Thanks for the idea. I should be able to narrow this down by the work I've done mentioned in my post just above.
Mewcenary Bernstein
Registered User
Join date: 18 Jul 2005
Posts: 9
07-27-2005 01:42
As an update to this, since I constrained the amount of memory the script used, the freezes no longer occur. Thanks guys!
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
07-27-2005 07:27
In answer to one of your questions, if a script has a runtime error while you're not online, you don't get an IM, it just dies. If you want to see whether a script has had a runtime error, take the object and rez it again. Any script that's dead will say its error message again when it's rezzed.