aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2013-06-05 23:44:26 +0100
committerMelanie2013-06-05 23:44:26 +0100
commite53b62304f557a26aa928b72e0961e135292146b (patch)
tree2fe588d969832c2de96dcf17880155dc552f7470 /OpenSim
parentPort Avination's inventory send throttling (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-e53b62304f557a26aa928b72e0961e135292146b.zip
opensim-SC_OLD-e53b62304f557a26aa928b72e0961e135292146b.tar.gz
opensim-SC_OLD-e53b62304f557a26aa928b72e0961e135292146b.tar.bz2
opensim-SC_OLD-e53b62304f557a26aa928b72e0961e135292146b.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs32
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapes.cs57
4 files changed, 84 insertions, 37 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 5b228ee..13f0167 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -62,6 +62,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
62 // count. The entries are removed when the interest count reaches 0. 62 // count. The entries are removed when the interest count reaches 0.
63 Dictionary<UUID,UUID> classifiedCache = new Dictionary<UUID, UUID>(); 63 Dictionary<UUID,UUID> classifiedCache = new Dictionary<UUID, UUID>();
64 Dictionary<UUID,int> classifiedInterest = new Dictionary<UUID, int>(); 64 Dictionary<UUID,int> classifiedInterest = new Dictionary<UUID, int>();
65 Object classifiedLock;
65 66
66 public Scene Scene 67 public Scene Scene
67 { 68 {
@@ -326,14 +327,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
326 string name = m["name"].AsString(); 327 string name = m["name"].AsString();
327 328
328 classifieds[cid] = name; 329 classifieds[cid] = name;
329 330
330 if(!classifiedCache.ContainsKey(cid)) 331 if(!classifiedCache.ContainsKey(cid))
331 { 332 {
332 classifiedCache.Add(cid,creatorId); 333 lock(classifiedCache)
333 classifiedInterest.Add(cid, 0); 334 classifiedCache.Add(cid,creatorId);
335 lock(classifiedInterest)
336 classifiedInterest.Add(cid, 0);
334 } 337 }
335 338
336 classifiedInterest[cid] ++; 339 lock(classifiedInterest)
340 classifiedInterest[cid] ++;
337 } 341 }
338 342
339 remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds); 343 remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds);
@@ -346,22 +350,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
346 ad.ClassifiedId = queryClassifiedID; 350 ad.ClassifiedId = queryClassifiedID;
347 351
348 if(classifiedCache.ContainsKey(queryClassifiedID)) 352 if(classifiedCache.ContainsKey(queryClassifiedID))
349 { 353 {
350 target = classifiedCache[queryClassifiedID]; 354 target = classifiedCache[queryClassifiedID];
351 355
352 if(classifiedInterest[queryClassifiedID] -- == 0) 356 lock(classifiedInterest)
357 classifiedInterest[queryClassifiedID] --;
358
359 if(classifiedInterest[queryClassifiedID] == 0)
353 { 360 {
361 lock(classifiedInterest)
362 classifiedInterest.Remove(queryClassifiedID);
354 lock(classifiedCache) 363 lock(classifiedCache)
355 {
356 lock(classifiedInterest)
357 {
358 classifiedInterest.Remove(queryClassifiedID);
359 }
360 classifiedCache.Remove(queryClassifiedID); 364 classifiedCache.Remove(queryClassifiedID);
361 }
362 } 365 }
363 } 366 }
364
365 367
366 string serverURI = string.Empty; 368 string serverURI = string.Empty;
367 bool foreign = GetUserProfileServerURI(target, out serverURI); 369 bool foreign = GetUserProfileServerURI(target, out serverURI);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b8ff7f7..bab14dd 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -121,6 +121,8 @@ namespace OpenSim.Region.Framework.Scenes
121 /// <remarks> 121 /// <remarks>
122 /// TODO: For some reason, we effectively have a list both here and in Appearance. Need to work out if this is 122 /// TODO: For some reason, we effectively have a list both here and in Appearance. Need to work out if this is
123 /// necessary. 123 /// necessary.
124 /// NOTE: To avoid deadlocks, do not lock m_attachments and then perform other tasks under that lock. Take a copy
125 /// of the list and act on that instead.
124 /// </remarks> 126 /// </remarks>
125 private List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); 127 private List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>();
126 128
@@ -971,19 +973,27 @@ namespace OpenSim.Region.Framework.Scenes
971 // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently 973 // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently
972 // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are 974 // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are
973 // not transporting the required data. 975 // not transporting the required data.
974 lock (m_attachments) 976 //
977 // We must take a copy of the attachments list here (rather than locking) to avoid a deadlock where a script in one of
978 // the attachments may start processing an event (which locks ScriptInstance.m_Script) that then calls a method here
979 // which needs to lock m_attachments. ResumeScripts() needs to take a ScriptInstance.m_Script lock to try to unset the Suspend status.
980 //
981 // FIXME: In theory, this deadlock should not arise since scripts should not be processing events until ResumeScripts().
982 // But XEngine starts all scripts unsuspended. Starting them suspended will not currently work because script rezzing
983 // is placed in an asynchronous queue in XEngine and so the ResumeScripts() call will almost certainly execute before the
984 // script is rezzed. This means the ResumeScripts() does absolutely nothing when using XEngine.
985 List<SceneObjectGroup> attachments = GetAttachments();
986
987 if (attachments.Count > 0)
975 { 988 {
976 if (HasAttachments()) 989 m_log.DebugFormat(
977 { 990 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
978 m_log.DebugFormat(
979 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
980 991
981 // Resume scripts 992 // Resume scripts
982 foreach (SceneObjectGroup sog in m_attachments) 993 foreach (SceneObjectGroup sog in attachments)
983 { 994 {
984 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 995 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
985 sog.ResumeScripts(); 996 sog.ResumeScripts();
986 }
987 } 997 }
988 } 998 }
989 } 999 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index afd547a..aad1108 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -360,7 +360,7 @@ public static class BSParam
360 new ParameterDefn<bool>("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat", 360 new ParameterDefn<bool>("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat",
361 false ), 361 false ),
362 new ParameterDefn<float>("PhysicsTimeStep", "If separate thread, seconds to simulate each interval", 362 new ParameterDefn<float>("PhysicsTimeStep", "If separate thread, seconds to simulate each interval",
363 0.1f ), 363 0.089f ),
364 364
365 new ParameterDefn<bool>("MeshSculptedPrim", "Whether to create meshes for sculpties", 365 new ParameterDefn<bool>("MeshSculptedPrim", "Whether to create meshes for sculpties",
366 true, 366 true,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
index 81edc12..867d2ab 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
@@ -389,9 +389,21 @@ public class BSShapeMesh : BSShape
389 } 389 }
390 public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) 390 public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim)
391 { 391 {
392 // Another reference to this shape is just counted. 392 BSShape ret = null;
393 IncrementReference(); 393 // If the underlying shape is native, the actual shape has not been build (waiting for asset)
394 return this; 394 // and we must create a copy of the native shape since they are never shared.
395 if (physShapeInfo.HasPhysicalShape && physShapeInfo.isNativeShape)
396 {
397 // TODO: decide when the native shapes should be freed. Check in Dereference?
398 ret = BSShapeNative.GetReference(pPhysicsScene, pPrim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX);
399 }
400 else
401 {
402 // Another reference to this shape is just counted.
403 IncrementReference();
404 ret = this;
405 }
406 return ret;
395 } 407 }
396 public override void Dereference(BSScene physicsScene) 408 public override void Dereference(BSScene physicsScene)
397 { 409 {
@@ -560,9 +572,21 @@ public class BSShapeHull : BSShape
560 } 572 }
561 public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) 573 public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim)
562 { 574 {
563 // Another reference to this shape is just counted. 575 BSShape ret = null;
564 IncrementReference(); 576 // If the underlying shape is native, the actual shape has not been build (waiting for asset)
565 return this; 577 // and we must create a copy of the native shape since they are never shared.
578 if (physShapeInfo.HasPhysicalShape && physShapeInfo.isNativeShape)
579 {
580 // TODO: decide when the native shapes should be freed. Check in Dereference?
581 ret = BSShapeNative.GetReference(pPhysicsScene, pPrim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX);
582 }
583 else
584 {
585 // Another reference to this shape is just counted.
586 IncrementReference();
587 ret = this;
588 }
589 return ret;
566 } 590 }
567 public override void Dereference(BSScene physicsScene) 591 public override void Dereference(BSScene physicsScene)
568 { 592 {
@@ -1075,12 +1099,23 @@ public class BSShapeGImpact : BSShape
1075 (w, iC, i, vC, v) => physicsScene.PE.CreateGImpactShape(w, iC, i, vC, v) ); 1099 (w, iC, i, vC, v) => physicsScene.PE.CreateGImpactShape(w, iC, i, vC, v) );
1076 } 1100 }
1077 1101
1078 public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) 1102 public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim)
1079 { 1103 {
1080 // Calling this reference means we want another handle to an existing shape 1104 BSShape ret = null;
1081 // (usually linksets) so return this copy. 1105 // If the underlying shape is native, the actual shape has not been build (waiting for asset)
1082 IncrementReference(); 1106 // and we must create a copy of the native shape since they are never shared.
1083 return this; 1107 if (physShapeInfo.HasPhysicalShape && physShapeInfo.isNativeShape)
1108 {
1109 // TODO: decide when the native shapes should be freed. Check in Dereference?
1110 ret = BSShapeNative.GetReference(pPhysicsScene, pPrim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX);
1111 }
1112 else
1113 {
1114 // Another reference to this shape is just counted.
1115 IncrementReference();
1116 ret = this;
1117 }
1118 return ret;
1084 } 1119 }
1085 // Dereferencing a compound shape releases the hold on all the child shapes. 1120 // Dereferencing a compound shape releases the hold on all the child shapes.
1086 public override void Dereference(BSScene physicsScene) 1121 public override void Dereference(BSScene physicsScene)