XEngine

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(WARNING! Do NOT copy the section below to your OpenSim.ini!)
(WARNING! Do NOT copy the section below to your OpenSim.ini!)
Line 63: Line 63:
 
  ThreadStackSize = 262144
 
  ThreadStackSize = 262144
 
     ''The stack size each script thread runs with. The default also represents the minimum''
 
     ''The stack size each script thread runs with. The default also represents the minimum''
 +
 +
; Controls whether scripts are stopped by aborting their threads externally (abort)
 +
; or by co-operative checks inserted by OpenSimulator into compiled script (co-op)
 +
; co-op will be more stable but this option is currently experimental.
 +
; If this setting is changed between co-op and abort, then existing scripts will automatically be recompiled if necessary.
 +
; However, the setting change will not take affect until the next time you restart the simulator.
 +
; Setting changes will not affect state information stored for scripts.
 +
ScriptStopStrategy = abort
 
   
 
   
 
  ; Rate to poll for asynchronous command replies (ms)
 
  ; Rate to poll for asynchronous command replies (ms)

Revision as of 11:54, 14 July 2014


Contents

Summary

This is a fully functional, full featured script engine which supports persistent script states and script state serialization.

This engine is enabled by default.

For each unique script asset, XEngine will create up to 4 files. These are:

  • CommonCompiler_compiled_<script-asset-id>.dll, the actual executable DLL for that script asset.
  • On mono, CommonCompiler_compiled_<script-asset-id>.mdb, the debug data file (necessary for resolving line numbers).
  • On Windows, CommonCompiler_compiled_<script-asset-id>.pdb, the debug data file (necessary for resolving line numbers).
  • CommonCompiler_source_CommonCompiler_compiled_<script-asset-id>.cs, if WriteScriptSourceToDebugFile = true in [XEngine] in OpenSim.ini. This is the C# source file as translated from the source language (e.g. from LSL) before compilation.

If scripts contain identical source code then there can be more than one script using the same code. However, they will maintain separate state files to record the script's individual state. These are labelled

  • <script-item-id>.state

For more information on state files, see below.

Configuration

XEngine is enabled by default in OpenSimulator. If you do need to enable it manually, make sure that the following line is present in your OpenSim.ini [Startup] section:

DefaultScriptEngine = "XEngine"

XEngine has a number of configuration options in OpenSim.ini, which are listed below, with an explanation and the default values:

WARNING! Do NOT copy the section below to your OpenSim.ini!

Use the template provided in OpenSim.ini.example. The section below contains syntactically incorrect documentation text, which is not meant to be placed in the OpenSim.ini file!

[XEngine]
 ; Allow the XEngine to run
 Enabled = true
    ''Without this, it won't run at all
 
 ; How many threads to keep alive even if nothing is happening
 MinThreads = 2
    ''XEngine will keep at least this many threads waiting''
 
 ; How many threads to start at maximum load
 MaxThreads = 100
    ''XEngine will not start more than this many scripts, even if that means blocking script execution''
 
 ; Time a thread must be idle (in seconds) before it dies
 IdleTimeout = 60
    ''Threads will die when they are not used for a while. This is the amount of time they must be'
    ''idle for that to happen''
 
 ; Thread priority ("Lowest", "BelowNormal", "Normal", "AboveNormal", "Highest")
 Priority = "BelowNormal"
    ''Script threads will run at this priority''
 
 ; Maximum number of events to queue for a script (excluding timers)
 MaxScriptEventQueue = 300
    ''Each script has a queue for events. This is the length of the queue, determining the number of''
    ''events that will be queued up before events are dropped''
 
 ; Stack size per thread created
 ThreadStackSize = 262144
    ''The stack size each script thread runs with. The default also represents the minimum''
 
 ; Controls whether scripts are stopped by aborting their threads externally (abort) 
 ; or by co-operative checks inserted by OpenSimulator into compiled script (co-op) 
 ; co-op will be more stable but this option is currently experimental.
 ; If this setting is changed between co-op and abort, then existing scripts will automatically be recompiled if necessary.
 ; However, the setting change will not take affect until the next time you restart the simulator.
 ; Setting changes will not affect state information stored for scripts.
 ScriptStopStrategy = abort
 
 ; Rate to poll for asynchronous command replies (ms)
 AsyncLLCommandLoopms = 50
    ''Interval between polls for asynchronous command results. Smaller values mean better response, but''
    ''also more burned CPU cycles''
 
 ; Save the source of all compiled scripts
 WriteScriptSourceToDebugFile = false
    ''Create a source file (.cs) on ScriptEngines, containing the preprocessed script''
 
 ; Default language for scripts
 DefaultCompileLanguage = lsl
    ''The default language to compile''
 
 ; List of allowed languages (lsl,vb,js,cs)
 AllowedCompilers = lsl,vb,js,cs
    ''The languages to allow for compiling''
 
 ; Compile debug info (line numbers) into the script assemblies
 CompileWithDebugInformation = true
    ''Create the .mdb debug file, which allows reporting of line numbers in runtime errors''
 
 ; Allow the use of os* functions (some are dangerous)
 AllowOSFunctions = false
    ''Allow the use if functions in the os* namespace''
 
 ; Interval (s) between background save of script states
 SaveInterval = 120
    ''Interval for script state persistence save.''
 
 ; Interval (s) between maintenance runs (0 = disable)
 MaintenanceInterval = 10
    ''Interval in seconds between maintenance runs. The maintenance run checks for long''
    ''running script events and terminates the scripts''
 
 ; Time a script can spend in an event handler before it is interrupted
 EventLimit = 30
    ''If a script spends more time in a single event handler, it will be interrupted.''
    ''This includes delays produced by llSleep() calls''
 
 ; If a script overruns it's event limit, kill the script?
 KillTimedOutScripts = false
    ''If a script gets terminated by the above timeout, suspend it pending a recompile?''
 
 ; Threat level to allow, one of None, VeryLow, Low, Moderate, High, VeryHigh, Severe
 OSFunctionThreatLevel = VeryLow
    ''osFunctions are rated by exploitability. This allows balancing functionality and risk

OS Functions enable/disable

For each function, you can add one line, as shown

; true is the default for all functions, and allows them if below threat level
Allow_osSetRegionWaterHeight = true
   This allows any user to use it, if the threat level permits

or

; false disables the function completely
Allow_osSetRegionWaterHeight = false
   Prevents anyone from using it

or

; Comma separated list of UUIDS allows the function for that list of UUIDS
Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb
   Allows only the listed user(s) to use these functions (unconditionally)

Both engines share the same parser and LSL implementation, so any script that runs on one can be expected to run on the other, with a few notable exceptions:

  • Resetting other scripts (XEngine only)
  • Stopping/starting other scripts (XEngine only)

State persistence

XEngine persists state and variable values for individual script instances across region restarts. This is stored in a .state file. When a script is deleted, the .state file is also deleted.

Personal tools
General
About This Wiki