MantisBT - opensim
View Issue Details
0007587opensim[REGION] Script Functionspublic2015-05-23 05:162015-05-23 07:20
Intel Core i7Ubuntu14.04
master (dev code) 
master (dev code) 
0.8.2 dev
Grid (1 Region per Sim)
Mono / Linux32
Singularity 1.8.6 OS X
0007587: llCastRay V3 suffers mesh cache race condition
llCastRay V3 sometimes reports:

2015-05-23 08:31:36,116 WARN - OpenSim.Region.Framework.Scenes.SceneGraph [SCENEGRAPH]: Problem processing action in ForEachSOG: An element with the same key already exists in the dictionary. at System.Collections.Generic.Dictionary`2[System.UInt64,OpenMetaverse.Rendering.FacetedMesh].Add (UInt64 key, OpenMetaverse.Rendering.FacetedMesh value) [0x00000] in <filename unknown>:0
  at OpenSim.Region.ScriptEngine.Shared.Api.LSL_Api+<llCastRayV3>c__AnonStorey10.<>m__0 (OpenSim.Region.Framework.Scenes.SceneObjectGroup group) [0x00632] in /home/opensim/git/opensim/opensim/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs:14341
  at OpenSim.Region.Framework.Scenes.SceneGraph.ForEachSOG (System.Action`1 action) [0x0001f] in /home/opensim/git/opensim/opensim/OpenSim/Region/Framework/Scenes/SceneGraph.cs:1158

This happens when several threads almost simultaneously creates and tries to add a missing geometry mesh to the mesh cache, so the mesh isn't in cache when they look for it but has been added before they have created and try to add it.
Setup several llCastRay scripts to cast rays through the same prim, sculpt or mesh. Trigger them as simultaneously as possible, e.g. by restarting the sim. Often but not always the above error is reported then.
Mono 3.12.1
No tags attached.
related to 0007546closed nebadon llCastRay only partly implemented 
related to 0007575closed nebadon llCastRay V3 performance improved by mesh caching 
patch 0001-Fix-mesh-cache-race-condition-in-llCastRay-V3.patch (1,810) 2015-05-23 05:16
Issue History
2015-05-23 05:16MagnuzNew Issue
2015-05-23 05:16MagnuzFile Added: 0001-Fix-mesh-cache-race-condition-in-llCastRay-V3.patch
2015-05-23 05:17MagnuzNote Added: 0028436
2015-05-23 05:17MagnuzStatusnew => patch included
2015-05-23 05:18MagnuzDescription Updatedbug_revision_view_page.php?rev_id=4200#r4200
2015-05-23 05:20MagnuzRelationship addedrelated to 0007546
2015-05-23 05:20MagnuzRelationship addedrelated to 0007575
2015-05-23 05:38nebadonNote Added: 0028437
2015-05-23 05:38nebadonStatuspatch included => resolved
2015-05-23 05:38nebadonResolutionopen => fixed
2015-05-23 05:38nebadonAssigned To => nebadon
2015-05-23 07:20MagnuzNote Added: 0028438
2015-05-23 07:20MagnuzStatusresolved => closed
2015-05-23 07:20MagnuzFixed in Version => master (dev code)

2015-05-23 05:17   
Patch adds an extra check before trying to add a created mesh to the mesh cache. The option to keep the mesh cache locked while the mesh is created would risk holding up threads and degrade performance, so the extra check is probably preferred.
2015-05-23 05:38   
patch applied : [^]
2015-05-23 07:20   
Verified code and function, so closing.