aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Interfaces (unfollow)
Commit message (Collapse)AuthorFilesLines
2013-02-12Use an integer when specifying the XWorkItem wait rather than a TimeSpan to ↵Justin Clark-Casey (justincc)1-1/+6
avoid a Windows casting issue in SmartThreadPool for large TimeSpans. TimeSpan.Milliseconds is an int64. However, STP casts this to an int (32-bit). If TimeSpan.MaxValue is given then the casting results in an invalid value for the SDK WaitHandle.WaitAll() call. This was causing the co-op script termination regression tests to fail on Windows but not Mono 2.10.8 (which is perhaps not strict in the negative values that it accepts). Solution here is to use the int millisecondsTimeout STP call rather than the TimeSpan one. This also allows us to more clearly specify Timeout.Infinite rather than TimeSpan.MaxValue Thanks to Teravus for this spot.
2013-01-23Pass narrower WaitHandle rather than EventWaitHandle as co-op termination ↵Justin Clark-Casey (justincc)1-1/+1
wait handle to script APIs. APIs don't need to reference any methods on EventWaitHandle
2013-01-23If ScriptStopStrategy hasn't been set to co-op in [XEngine] config, then ↵Justin Clark-Casey (justincc)1-0/+8
continue to generate C# that is functionality identical to historical generation This is to eliminate disruption until co-op termination has been well-tested. In non co-op mode, XEngine will continue to load DLLs of the existing Script class and the new XEngineScript class. Moving to co-op mode still requires existing script DLL deletion to force recompilation, either manually or by setting DeleteScriptsOnStartup = true for one run. This change also means that scripts which fail to initialize do not still show up as running scripts.
2013-01-17Implement non-wait co-operative termination of scripts for XEngine in ↵Justin Clark-Casey (justincc)1-5/+30
addition to termination on wait. This involves inserting opensim_reserved_CheckForCoopTermination() calls in lsl -> c# translation at any place where the script could be in a loop with no wait calls. These places are for, while, do-while, label, user function call and manual event function call. Call goes through to an XEngineScriptBase which extends ScriptBase. IEngine is extended to supply necessary engine-specific parent class references and constructor parameters to Compiler. Unfortunately, since XEngineScriptBase has to be passed WaitHandle in its constructor, older compiled scripts will fail to load with an error on the OpenSim console. Such scripts will need to be recompiled, either by removing all *.dll files from the bin/ScriptEngines/<region-id> or by setting DeleteScriptsOnStartup = true in [XEngine] for one run. Automatic recompilation may be implemented in a later commit. This feature should not yet be used, default remains termination with Thread.Abort() which will work as normal once scripts are recompiled.
2013-01-16JustinCC's core re-mergeMelanie2-6/+22
2013-01-16Implement co-operative script termination if termination comes during a ↵Justin Clark-Casey (justincc)2-2/+8
script wait event (llSleep(), etc.) This makes use of EventWaitHandles since various web references indicate that Thread.Interrupt() can also cause runtime instability. If co-op termination is enabled, then termination sets the wait handle instead of waiting for a timeout before possibly aborting the thread. This allows the script to cleanly terminate if it's in a llSleep/LL function delay or the next time it enters such a wait without any timeout period. Co-op termination is not yet testable since checking for termination request within loops that never trigger a wait is not yet implemented. This commit, unlike 1b5c41c, passes the wait handle as an extra parameter through IScript.Initialize() instead of passing IScriptInstance itself.
2013-01-16Revert "Implement co-operative script termination if termination comes ↵Justin Clark-Casey (justincc)1-13/+0
during a script wait event (llSleep(), etc.)" Doing this as a favour to Melanie. This will be back with passing the wait handles directly to the api. This reverts commit 1b5c41c14ad11325be249ea1cce3c65d4d6a89be.
2013-01-16Implement co-operative script termination if termination comes during a ↵Justin Clark-Casey (justincc)1-0/+13
script wait event (llSleep(), etc.) This makes use of EventWaitHandles since various web references indicate that Thread.Interrupt() can also cause runtime instability. If co-op termination is enabled, then termination sets the wait handle instead of waiting for a timeout before possibly aborting the thread. This allows the script to cleanly terminate if it's in a llSleep/LL function delay or the next time it enters such a wait without any timeout period. Co-op termination is not yet testable since checking for termination request within loops that never trigger a wait is not yet implemented.
2013-01-15Instead of passing separate engine, part and item components to script APIs, ↵Justin Clark-Casey (justincc)2-6/+16
pass down IScriptInstance instead. This is to allow the future co-operative script thread terminate feature to detect and act upon termination requests. This splits the assembly and state loading out from the ScriptInstance() constructor to a separate Load() method in order to facilititate continued script logic regression testing.
2012-12-17Extend default 1 second wait for event completion to other thread script ↵Justin Clark-Casey (justincc)1-1/+30
reset (as called by llResetOtherScript()). As with script stop (via llDie()) aborting other scripts event threads, llResetOtherScript() can also abort any current event thread on another script. On mono 2.6, 2.10 and possibly later this may cause locking problems in certain code areas. This commit reuses the recently introduced [XEngine] WaitForEventCompletionOnScriptStop to make this a 1 sec timeout, rather than 0 secs.
2012-12-12Add "debug script log" command to allow setting a numeric debug level on ↵Justin Clark-Casey (justincc)1-0/+12
individual IScriptInstances for debugging purposes. Current, state changes and event fires can be logged for individual scripts. See command help for more details.
2012-12-05Add IScriptInstance.EventsQueued to match EventsProcessed instead of asking ↵Justin Clark-Casey (justincc)1-0/+5
callers to lock and directly inspect the EventQueue
2012-12-05Add IScriptInstance.EventsProcessed stat so that we can record this ↵Justin Clark-Casey (justincc)1-0/+5
information and display in "show scripts" for debug purposes
2012-07-16Revert "Fix script "Running" behavior"Melanie1-10/+0
A better solution using the already present flags must be found. This reverts commit 6d3ee8bb39d47ed7b32e8905fa0b2fc31c5a9f80.
2012-06-23Fix script "Running" behaviorBlueWall1-0/+10
Unchecking "Running" box in script editor now persists. This fixes http://opensimulator.org/mantis/view.php?id=6057
2012-05-08refactor: Eliminate local id parameter from api initialize.Justin Clark-Casey (justincc)1-2/+1
This is always available from m_host.LocalId
2012-05-08Instead of constantly looking up unchanging self item in script code, pass ↵Justin Clark-Casey (justincc)1-7/+13
in self item on initialization.
2012-03-16Aggregate script execution times by linksets rather than individual prims.Justin Clark-Casey (justincc)1-0/+11
This is for the top scripts report.
2012-03-16Replace script-lines-per-second with the script execution time scaled by its ↵Justin Clark-Casey (justincc)1-0/+15
measurement period and an idealised frame time. The previous lines-per-second measurement used for top scripts report was inaccurate, since lines executed does not reflect time taken to execute. Also, every fetch of the report would reset all the numbers limiting its usefulness and we weren't even guaranteed to see the top 100. The actual measurement value should be script execution time per frame but XEngine does not work this way. Therefore, we use actual script execution time scaled by the measurement period and an idealised frame time. This is still not ideal but gives reasonable results and allows scripts to be compared. This commit moves script execution time calculations from SceneGraph into IScriptModule implementations.
2012-03-15Remove property/field duplication in ScriptInstance where it's unnecessary.Justin Clark-Casey (justincc)1-0/+8
2012-03-14refactor: rename ScriptInstance.m_CurrentResult to m_CurrentWorkItem to make ↵Justin Clark-Casey (justincc)1-2/+6
it more understandable as to what it is and what it does (hold a thread pool work item for a waiting of in-progress event) Also add other various illustrative comments
2012-01-14Register the UrlModule for script engine events OnScriptRemoved and ↵Justin Clark-Casey (justincc)1-7/+0
OnObjectRemoved just once in the UrlModule itself, rather than repeatedly for every script. Doing this in every script is unnecessary since the event trigger is parameterized by the item id. All that would happen is 2000 scripts would trigger 1999 unnecessary calls, and a large number of initialized scripts may eventually trigger a StackOverflowException. Registration moved to UrlModule so that the handler is registered for all script engine implementations. This required moving the OnScriptRemoved and OnObjectRemoved events (only used by UrlModule in core) from IScriptEngine to IScriptModule to avoid circular references.
2011-10-19add current script status to "scripts show" command (running, suspended, etc.)Justin Clark-Casey (justincc)1-1/+6
2011-08-24Fix llAttachToAvatar()Justin Clark-Casey (justincc)1-0/+11
Apart from one obvious bug, this was failing because attempting to serialize the script from inside the script (as part of saving the attachment as an inventory asset) was triggering an extremely long delay. So we now don't do this. The state will be serialized anyway when the avatar normally logs out. The worst that can happen is that if the client/server crashes, the attachment scripts start without previous state.
2010-12-03Revert "Revert "Trigger changed event with CHANGED_TELEPORT when teleporting ↵Melanie1-1/+2
to another region."" This reverts commit 6c01ebb87541ecf66d678606bb97d996bee51953.
2010-12-03Revert "Trigger changed event with CHANGED_TELEPORT when teleporting to ↵Melanie1-2/+1
another region." This reverts commit 2827deffe822378b6cb35dac6c90a21c3fbc0de7. Pulling out a bad core commit that broke attachment teleporting for us
2010-11-26Trigger changed event with CHANGED_TELEPORT when teleporting to another region.Marck1-1/+2
2010-09-26Merge MasterMelanie1-0/+1
2010-09-26Add configurable path to script engine assembliesBlueWall1-0/+1
Adding ability to place script engine assemblies outside the codebase directories. Uses new [XEngine] option: ScriptEnginesPath = "path_to_assemblies" Signed-off-by: Melanie <melanie@t-data.com>
2010-08-06People can't leave their hands ooff "well enough". StateSource 0 was regionMelanie1-4/+5
start, and they started at 1 for real values. Whoever changed that enum to start at 0 should bow their head in shame. They broke the region start event. This puts it right again. Meow!
2010-08-06Fix StateSource constants, provide RegionStartTom1-4/+5
2010-04-19All scripts are now created suspended and are only unsuspended when the objectMelanie1-0/+3
is fully rezzed and all scripts in it are instantiated. This ensures that link messages will not be lost on rez/region crossing and makes heavily scripted objects reliable.
2009-12-22Revert "Remove an insterface member that was never used"Melanie1-0/+1
It was used. By the API, which is dynamically loaded. So it didn't complain until it hit Bamboo This reverts commit 33d5018e94e52cb875bf43bced623bdc6aa41ef0.
2009-12-22Remove an insterface member that was never usedMelanie1-1/+0
2009-11-26Remove the old (Remoting) region crossing code. Fix the new code toMelanie1-1/+0
pass script state and assembly again properly. Reintroduce respecting tht TrustBinaries flag. Changes the interregion protocol! No version bump because it was broken anyway, so with a version mismatch it will simply stay broken, but not crash. Region corssing still doesn't work because there is still monkey business with both rezzed prims being pushed across a border and attached prims when walking across a border. Teleport is untested by may work.
2009-10-29OptimizationsDan Lake1-3/+1
2009-09-01Experimental. Set attachment flag early on rezzing from inventory.Melanie1-1/+0
2009-08-31Change the return value if the compiler to "object" to allow compilersMelanie1-2/+2
to return dynamic method objects
2009-08-07Another stab at cmickeyb's patch for script GC.Melanie1-0/+2
Moved the Close() for the appdomain-hosted parts into a new destructor on ScriptInstance.
2009-08-07Revert the XEngine memleak patch, it causes premature GC.Melanie1-2/+0
This matches behavior seen with an earlier attempt to do this, apparently the sponsor mechanism does't work in Mono
2009-08-06|From: James J Greensky <jame.j.greensky@intel.com>Melanie1-0/+2
|Date: Wed, 5 Aug 2009 09:51:52 -0700 |Subject: [PATCH] Closed two major memory leaks for scripted objects | |Two major memory leaks for the scripted objects were fixed |- One leak had to do with remoting acrossing app domains. When a script and | its controlling agent communicate across an application boundary, it calls | functions on a stub proxy object that then invokes the remote method on | the object in the other app domain. These stub objects (two for each script) | were setup to have infinate lifetimes and were never being garbage collected. |- The second leak was the result of adding a scene object part instance method | to a scene event and never removing it. This cause the event's delegate list | to maintain a link to that object which is then never freed as the scene event | object is never destroyed. Patch applied, please direct feedback to me. Possible issue: Longtime idle scripts like vendors may fail.
2009-08-04 Slight change to state management for attach scheduling.Alan Webb1-1/+2
Signed-off-by: dr scofield (aka dirk husemann) <drscofield@xyzzyxyzzy.net>
2009-08-04Add plumbing for the SceneObjectDeleter to wait for the script engine toMelanie1-0/+1
allow final deletion of objects. Meant to support the attach(NULL_KEY) event,
2009-06-21Publish a method on ICompiler to generate the CIL assembly pathMelanie Thielker1-0/+1
Cause group deeding to apply next owner perms
2009-06-06Correct an error where the config file name was always considered to be aMelanie Thielker1-0/+1
local file. This caused llHttpRequest and llSetInventoryPermsMask to fail on regions that load their config from a web server
2009-06-05Thank you, thomax, for a patch to provide finer-grained access control toMelanie Thielker1-1/+2
scripting. Fixes Mantis #2862
2009-06-01Minor: Change OpenSim to OpenSimulator in older copyright headers and ↵Jeff Ames5-5/+5
LICENSE.txt.
2009-04-15Convert both script engines to new region module format. Add proper unloadMelanie Thielker1-0/+1
handling to XEngine. Add needed stubs to DotNetEngine.
2009-04-10Introduce IXmlRpcRouter, an interface that allows registering XMLRPCMelanie Thielker1-0/+3
UUIDs with a central marshaller for grids, or publish the ULS for objects elsewhere.
2009-04-10Add events to IScriptEngine to notify scripting modules of the removalMelanie Thielker1-0/+7
of objects from the scene, and of scripts from objects. This facilitates the development of modules that can register prims with externall servers for inbound email and XMLRPC. Currently implemented in XEngine only. Also applying cmickeyb's compiler locking patch, since it seems risk-free.