Jump to content

OpenSimulator Internals/Walkthroughs/Bring Up Region

From Open Simulator Technical Help

OpenSimulator Internals/Walkthroughs/Bring Up Region

[edit]

Overview

[edit]

Traces what happens from running OpenSim.exe to the region being ready for logins. Assumes ROBUST is already up -- see OpenSimulator Internals/Walkthroughs/Bring Up Grid.

See OpenSimulator Internals/Code Map/OpenSim and OpenSimulator Internals/Code Map/Scene for the component reference this walkthrough is built from.


Steps

[edit]

1. Process starts

[edit]
OpenSim/Region/Application/OpenSim.cs -- StartupSpecific()

Console created (local/basic/rest/GUI depending on config). base.StartupSpecific() called -- see OpenSimBase below. No database activity yet at this point.

2. OpenSimBase startup

[edit]
OpenSim/Region/Application/OpenSimBase.cs -- StartupSpecific()
  1. Refuses to run if CombineContiguousRegions is set (fatal)
  2. Loads SimulationDataStore plugin -- this is the region database connection (osimdev_t1), throws if [SimulationDataStore] is missing
  3. Loads EstateDataStore plugin -- throws if missing
  4. Calls base.StartupSpecific() (RegionApplicationBase) -- reads Regions.ini, iterates each [RegionName] section
  5. Loads application plugins from /OpenSim/Startup
  6. PostInitialise() called on all plugins

At this point the simulation and estate database connections exist but no region-specific rows have been touched yet.

3. Region creation

[edit]
OpenSim/Region/Application/OpenSimBase.cs -- CreateRegion()

Called once per [RegionName] section found in Regions.ini.

  1. Gets IRegionModulesController -- fatal exit if missing
  2. Sets region ServerURI (http://osimdev.org:9000/ for T1)
  3. Calls SetupScene() -- creates AgentCircuitManager, constructs Scene object (see step 4)
  4. controller.AddRegionToModules(scene) -- every region module is instantiated and attached: physics engine, script engine, asset/inventory/grid connectors (in grid mode these are the remote connectors calling ROBUST), estate module, land management, attachments module, entity transfer module, etc.
  5. Verifies required permissions modules loaded if SecurePermissionsLoading=true -- fatal exit if missing
  6. scene.SetModuleInterfaces() -- Scene's lazy-loaded service properties and module references are wired up
  7. SetUpEstateOwner() if estate has no owner -- prompts console interactively, can create the owner UserAccount via UserAccountService if running standalone
  8. scene.loadAllLandObjectsFromStorage() -- SELECT from land table in osimdev_t1
  9. scene.LoadPrimsFromStorage() -- SELECT from prims, primshapes, primitems -- builds SceneObjectGroup for every linkset, calls AddRestoredSceneObject() for each
  10. scene.RegisterRegionWithGrid() -- see step 5
  11. scene.CreateScriptInstances() -- script engine starts for every loaded object with scripts
  12. Scene added to SceneManager
  13. scene.EventManager.OnShutdown hooked

4. Scene construction

[edit]
OpenSim/Region/Framework/Scenes/Scene.cs (full constructor)
  1. Loads RegionSettings from SimulationDataService -- SELECT from regionsettings. If terrain textures are zero UUIDs, defaults are assigned and saved back (UPDATE)
  2. Loads EstateSettings from EstateDataService -- SELECT from estate_settings via estate_map
  3. Reads [Startup], [EntityTransfer], [InterestManagement] config sections -- draw distances, prim size limits, physics flags, script engine choice, frame timing, persistence windows
  4. Creates SimStatsReporter
  5. StartTimerWatchdog() -- 1-second interval timer begins (independent of the Heartbeat thread)

5. Grid registration

[edit]
OpenSim/Region/Framework/Scenes/Scene.cs -- RegisterRegionWithGrid()
  1. m_sceneGridService.SetScene(this)
  2. RegenerateMaptile() if m_generateMaptiles is true -- builds and stores a map tile asset
  3. Builds GridRegion from RegionInfo, calls GridService.RegisterRegion()
  4. On ROBUST side: see OpenSimulator Internals/GridService RegisterRegion() -- validates coordinates, checks for overlaps, applies region flags, writes to regions table with RegionOnline flag set
  5. Throws on failure -- this is a fatal startup error in OpenSimBase.CreateRegion()

6. Heartbeat starts

[edit]
OpenSim/Region/Framework/Scenes/Scene.cs -- Start() → Heartbeat()
  1. First Update(1) runs without watchdog alarm (avoids false positives from startup load)
  2. Watchdog alarm enabled
  3. Update(-1) begins the continuous per-frame loop -- see OpenSimulator Internals/Code Map/Scene for full frame breakdown

7. Logins enabled

[edit]

At frame 20 of the Update loop:

  1. Large object heap compaction, forced GC
  2. LoginsEnabled = true (if not StartDisabled and not LoginLock)
  3. m_sceneGridService.InformNeighborsThatRegionisUp() -- notifies any registered neighbour regions
  4. Ready = true
  5. Optional: writes a .ready marker file if RestartModule.MarkerPath is configured

If LoginLock is true (set by RegionReady module) and there are scripts to compile, login enabling is deferred until script compilation completes, signalled via IRegionReadyModule.


Database Activity Summary

[edit]
Database Table Activity
osimdev_t1 regionsettings SELECT, possibly UPDATE if textures were unset
osimdev_t1 estate_settings, estate_map SELECT
osimdev_t1 land SELECT (loadAllLandObjectsFromStorage)
osimdev_t1 prims, primshapes, primitems SELECT (LoadPrimsFromStorage)
osimdev_t1 terrain SELECT (LoadWorldMap, called from SetupScene)
osimdev_robust regions INSERT or UPDATE (RegisterRegion)
osimdev_robust assets INSERT if a new map tile was generated

Console Output Landmarks

[edit]

From a real T1 startup (osimdev), in order:

  1. Per-prim/script object loading messages
  2. "[SCENE]: Region {0} ({1}) registered at {2},{3} with flags {4}" equivalent from GridService
  3. "Initializing script instances in T1"
  4. "[ubOde]: N prim actors loaded"
  5. "[YEngine]: StartProcessing"
  6. "[RegionReady]: Region "T1" is ready"
  7. "INITIALIZATION COMPLETE FOR T1 - LOGINS ENABLED"

See Also

[edit]