tour script has unresolvable error

Creating scripts
User avatar
Alexina Proctor
Posts: 97
Joined: Sun Mar 16, 2014 2:32 am
Has thanked: 773 times
Been thanked: 112 times
Contact:

tour script has unresolvable error

Post by Alexina Proctor »

We are trying to get a tour script running on a 16-region world but it keeps failing - stops dead with the error:
"Restarting script due to event timeout (Script: "-DragonForge Tour System v05 OSSL", State: default"

On Kitely we are running with ODE because of MESH issues with too many houses that we cannot replace yet.
16-region world:
Simulator Version: OpenSim 0.9.1.1 Snail Release (Unix/Mono)
Physics Engine Name: OpenDynamicsEngine 1.0
Script Engine Name: XEngine

OSgrid private world of person who wrote the script:
Simulator Version: OpenSim 0.9.1.0 Snail Dev OSgrid 0.9.1.0 304d72565d: 2019-09-07 01:25:32 +0100 (Win/.NET)
Physics Engine Name: ubODE 1.0
Script Engine Name: XEngine

The script writer spent hours on this today. First thinking it was llSleep() function, so he wrote a workaround and didn't use that function. The same problem happens.

We cannot figure out what causes this failure. Any ideas?
These users thanked the author Alexina Proctor for the post:
Ilan Tochner
--Alexina Proctor
Co-founder with Prax Maryjasz of Sendalonde Community Library
Library: hop://grid.kitely.com:8002/Wellspring
https://virtualpeers.com/
User avatar
Ilan Tochner
Posts: 6504
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4943 times
Been thanked: 4455 times
Contact:

Re: tour script has unresolvable error

Post by Ilan Tochner »

Hi Alexina,

It's hard to comment about what may be causing a script to time out without seeing the script in question. But if it runs fine on the same script engine but using a different physics engine then the issue is likely related to some physics dependent function you're calling.
These users thanked the author Ilan Tochner for the post:
Alexina Proctor
User avatar
Snoots Dwagon
Posts: 422
Joined: Mon Jul 30, 2018 9:45 pm
Has thanked: 442 times
Been thanked: 779 times

Re: tour script has unresolvable error

Post by Snoots Dwagon »

I would agree with this Ilan... except that this is a movement base script and (to my knowledge) no physics routines are being used.

We wrote a test script that had a vehicle move in a square (non-physical movement). The script was originally written and tested on OSgrid, where it performs as expected. But when that script is run on Kitely, it throws the error at around 30 seconds in every instance.

The primary line used to move the item is this:

llSetLinkPrimitiveParamsFast(1,[PRIM_POSITION,moveto,PRIM_ROTATION,curRot])

There is a function to slow down or speed up the number of times this command is called. No matter how "slow" or "fast" the vehicles runs (number of moves made per second), it times out at appx 30 seconds. So script activity / number of repetitions has been ruled out as a cause.

The error indicates "event timeout" but doesn't specify what event is in use when the timeout occurs. As near as I can tell it is a listen even that calls a subroutine... and the subroutine performs all of the movement. The logic: Listen "hears" to start the vehicle, calls the automatic movement routine, vehicle experiences "event timeout" at a little over 30 seconds.

I attempted to test this out on a sandbox using a different physics engine but could not due to the script using OSSL notecard creation functions (one has to wonder what it is about creating a notecard in a prim that is considered a security risk by Opensim. I suppose there must be reasons).

So, as far as I can determine the script doesn't employ the physics engine, unless changing a prim's position is a physics call. We can't use Bullet or Ubode because of what they do to the 16 regions of $$$mesh buildings and creations existent on Wellspring (which work under ODE but "break" under Bullet or Ubode). If this was a physical vehicle I could see that maybe there would be a physics issue involved, but this is an event timeout... where no timeout logically exists (unless there's a limit as to how long an event can function. In 16 years of scripting I've not once encountered such an issue.)

So it's a head-scratcher.
These users thanked the author Snoots Dwagon for the post:
Alexina Proctor
~~~~~~~
I'm a dwagon in real life too. (Ask my sister, who totally agrees.)

~~~~~~~
User avatar
Ilan Tochner
Posts: 6504
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4943 times
Been thanked: 4455 times
Contact:

Re: tour script has unresolvable error

Post by Ilan Tochner »

Hi Snoots,

If you're moving a non-phantom object then the physics engine is involved. Please try making the object phantom to see if you still get this error.
These users thanked the author Ilan Tochner for the post (total 2):
Alexina ProctorSnoots Dwagon
User avatar
Christine Nyn
Posts: 71
Joined: Sat Mar 07, 2020 10:20 pm
Has thanked: 218 times
Been thanked: 126 times

Re: tour script has unresolvable error

Post by Christine Nyn »

As the error shows after 30 seconds the script will be falling foul of this setting from the OpenSim.ini file:

;# {EventLimit} {} {Amount of time a script can spend in an event handler} {} 30
;; Time a script can spend in an event handler before it is interrupted
; EventLimit = 30

Which being so I'd hazard a guess that whatever event the script goes to to perform its movements is not being returned from before the time limit is up. Look for an extensive for() loop somewhere or possibly a do-while. Bear in mind that a user function called once from within an event is still
technically within that event and that the problem may lie there.
These users thanked the author Christine Nyn for the post (total 3):
Ilan TochnerAlexina ProctorSnoots Dwagon
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: tour script has unresolvable error

Post by John Mela »

We have encountered this issue a lot in the RezMela system, which is often processing large volumes of data. It's a quirk of OpenSim, and unfortunately there's often no easy fix.

The technique I use in most cases is to store all the data to be processed in a list, and to use a linked message (from the script to itself) to trigger a link_message() event, which contains the code to process the list. Then make that code only process part of the list - say the first 100 elements - delete those elements from the list and then re-trigger itself by repeating the linked message, unless the list is now empty and processing has finished.

It's tempting to have the processing check its elapsed time to see when to stop and re-trigger, but the danger with that is that the time-checking itself slows things down and reduces the number of iterations possible. So instead, I've tended to stop the loop after about 25% of the timeout limit has been used under normal load, to give headroom for increased loads.

My own opinion is that, while I understand the need to impose limits on events, to use elapsed time check to do so is fundamentally flawed. That's because load on the server - which may be nothing to do with the script in question - can affect the elapsed time and penalise the script. In fact, there is no guarantee that any script that uses any kind of loop - however efficient and well-written - won't fall foul of this issue when the server is very heavily loaded. And, of course, since the exception names the script that encountered the timeout, the script will get the blame (not to mention that the script is likely to cease functioning since it may have been stopped).

It's a tough one, and unfortunately addressing the issue increases complexity with all the side-effects of that!
These users thanked the author John Mela for the post (total 3):
Snoots DwagonAlexina ProctorChristine Nyn
User avatar
Snoots Dwagon
Posts: 422
Joined: Mon Jul 30, 2018 9:45 pm
Has thanked: 442 times
Been thanked: 779 times

Re: tour script has unresolvable error

Post by Snoots Dwagon »

Thank you so very much, Ilan, Chrystine (HI Christine! :D), and John. Christine you've undoubtedly hit on the core issue! I was speaking to Alexina yesterday and said:

"This is what it's acting like. It's acting like the script is saying, 'I'll do what you want me to do, exactly how you want me to do it, but after 30 seconds I'm going to bash my head against a wall and knock myself out'." Mwahahahahaa...

That 30 second event limiter (I'm sure Opensim thinks there's a good reason for that), is just what's happening. I was using a listen event to accept a command from the user, then accessing a subroutine to perform a lengthy function. Logically this should work just fine. But the script goes derp after 30 seconds or so.

John, you're absolutely right. I had a feeling something like this was happening (though I didn't know)... and had actually considered using the message() event to solve that problem, so yup, your solution would have worked I think. I instead opted for repeated calls to the timer() event, which solved the problem, kinda, sorta. It is somewhat like using a sledgehammer with one hand to drive a nail, but it worked. At 5:30am. in the morning. (snorts)

However, the more I think about it, the more I'm leaning toward using linked_message() instead. I think your suggestion in that will make a more efficient script.

Thank you all for pinpointing this... and providing solutions. At least now I know what is going on. Awesome the bunch of you. And thank you Alexina for posting this forum so they could do so. : )

/me hands out cookies all around
Last edited by Snoots Dwagon on Tue Oct 13, 2020 11:46 pm, edited 1 time in total.
These users thanked the author Snoots Dwagon for the post:
Alexina Proctor
~~~~~~~
I'm a dwagon in real life too. (Ask my sister, who totally agrees.)

~~~~~~~
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: tour script has unresolvable error

Post by John Mela »

Using the timer will work too, but the advantage of using linked messages is that you don't have the minimum timer delay for each iteration - it's pretty much instant instead.
These users thanked the author John Mela for the post (total 3):
Alexina ProctorSnoots DwagonChristine Nyn
User avatar
Snoots Dwagon
Posts: 422
Joined: Mon Jul 30, 2018 9:45 pm
Has thanked: 442 times
Been thanked: 779 times

Re: tour script has unresolvable error

Post by Snoots Dwagon »

Yups, you're right John. I just tried linked_message() instead and as you state, no delays. With the timer(), even a time of .01 or .001 causes enough of a delay just in calling the timer to cause the script to pause approximately 1/4 second (which as little as that sounds, is very noticeable). Using a message link has pretty much zero discernible delay.

Thanks for that tip. The script is working perfectly now.

(Doncha just luv these kinds of scripting issues?)

/me kicks the script engines, physics engines, region engines, asset servers, OS brands and the Internet in general. Mwahahahaaaa...
Last edited by Snoots Dwagon on Tue Oct 13, 2020 11:44 pm, edited 3 times in total.
These users thanked the author Snoots Dwagon for the post:
Alexina Proctor
~~~~~~~
I'm a dwagon in real life too. (Ask my sister, who totally agrees.)

~~~~~~~
User avatar
Alexina Proctor
Posts: 97
Joined: Sun Mar 16, 2014 2:32 am
Has thanked: 773 times
Been thanked: 112 times
Contact:

Re: tour script has unresolvable error

Post by Alexina Proctor »

Thank you Snoots for rewriting your code to make sure we have the very best tour system. I am looking forward to setting up the ferry tour later this week with the Dragonforge Tour System,
These users thanked the author Alexina Proctor for the post:
Snoots Dwagon
--Alexina Proctor
Co-founder with Prax Maryjasz of Sendalonde Community Library
Library: hop://grid.kitely.com:8002/Wellspring
https://virtualpeers.com/
Post Reply