diff options
author | Justin Clark-Casey (justincc) | 2011-11-22 22:46:25 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-11-22 22:46:25 +0000 |
commit | b56410285b1af7c5fc2b4a84d8c9c734d2238ff0 (patch) | |
tree | e2c056b004befea93a6b5dedc6ebb24d41dbd9c2 /OpenSim | |
parent | Stop removing actor from the hash maps in OdeScene.RemoveCharacter() since th... (diff) | |
download | opensim-SC_OLD-b56410285b1af7c5fc2b4a84d8c9c734d2238ff0.zip opensim-SC_OLD-b56410285b1af7c5fc2b4a84d8c9c734d2238ff0.tar.gz opensim-SC_OLD-b56410285b1af7c5fc2b4a84d8c9c734d2238ff0.tar.bz2 opensim-SC_OLD-b56410285b1af7c5fc2b4a84d8c9c734d2238ff0.tar.xz |
Log error if we attempt to add/remove an OdeCharacter from the _characters list inappropriately
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 7b04bcf..0456f56 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -377,8 +377,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
377 | /// <param value="name">Name of the scene. Useful in debug messages.</param> | 377 | /// <param value="name">Name of the scene. Useful in debug messages.</param> |
378 | public OdeScene(string name) | 378 | public OdeScene(string name) |
379 | { | 379 | { |
380 | m_log | 380 | m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name); |
381 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name); | ||
382 | 381 | ||
383 | Name = name; | 382 | Name = name; |
384 | 383 | ||
@@ -769,7 +768,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
769 | } | 768 | } |
770 | catch (AccessViolationException) | 769 | catch (AccessViolationException) |
771 | { | 770 | { |
772 | m_log.Warn("[PHYSICS]: Unable to collide test a space"); | 771 | m_log.Warn("[ODE SCENE]: Unable to collide test a space"); |
773 | return; | 772 | return; |
774 | } | 773 | } |
775 | //Colliding a space or a geom with a space or a geom. so drill down | 774 | //Colliding a space or a geom with a space or a geom. so drill down |
@@ -821,17 +820,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
821 | 820 | ||
822 | count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf); | 821 | count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf); |
823 | if (count > contacts.Length) | 822 | if (count > contacts.Length) |
824 | m_log.Error("[PHYSICS]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length); | 823 | m_log.Error("[ODE SCENE]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length); |
825 | } | 824 | } |
826 | catch (SEHException) | 825 | catch (SEHException) |
827 | { | 826 | { |
828 | m_log.Error( | 827 | m_log.Error( |
829 | "[PHYSICS]: The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim."); | 828 | "[ODE SCENE]: The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim."); |
830 | base.TriggerPhysicsBasedRestart(); | 829 | base.TriggerPhysicsBasedRestart(); |
831 | } | 830 | } |
832 | catch (Exception e) | 831 | catch (Exception e) |
833 | { | 832 | { |
834 | m_log.WarnFormat("[PHYSICS]: Unable to collide test an object: {0}", e.Message); | 833 | m_log.WarnFormat("[ODE SCENE]: Unable to collide test an object: {0}", e.Message); |
835 | return; | 834 | return; |
836 | } | 835 | } |
837 | 836 | ||
@@ -1556,7 +1555,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1556 | } | 1555 | } |
1557 | catch (AccessViolationException) | 1556 | catch (AccessViolationException) |
1558 | { | 1557 | { |
1559 | m_log.WarnFormat("[PHYSICS]: Unable to space collide {0}", Name); | 1558 | m_log.WarnFormat("[ODE SCENE]: Unable to space collide {0}", Name); |
1560 | } | 1559 | } |
1561 | 1560 | ||
1562 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); | 1561 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); |
@@ -1587,13 +1586,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1587 | removeprims = new List<OdePrim>(); | 1586 | removeprims = new List<OdePrim>(); |
1588 | } | 1587 | } |
1589 | removeprims.Add(chr); | 1588 | removeprims.Add(chr); |
1590 | m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); | 1589 | m_log.Debug("[ODE SCENE]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); |
1591 | } | 1590 | } |
1592 | } | 1591 | } |
1593 | } | 1592 | } |
1594 | catch (AccessViolationException) | 1593 | catch (AccessViolationException) |
1595 | { | 1594 | { |
1596 | m_log.Warn("[PHYSICS]: Unable to space collide"); | 1595 | m_log.Warn("[ODE SCENE]: Unable to space collide"); |
1597 | } | 1596 | } |
1598 | } | 1597 | } |
1599 | } | 1598 | } |
@@ -1729,13 +1728,24 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1729 | _characters.Add(chr); | 1728 | _characters.Add(chr); |
1730 | 1729 | ||
1731 | if (chr.bad) | 1730 | if (chr.bad) |
1732 | m_log.ErrorFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid); | 1731 | m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to characters list", chr.m_uuid); |
1732 | } | ||
1733 | else | ||
1734 | { | ||
1735 | m_log.ErrorFormat( | ||
1736 | "[ODE SCENE]: Tried to add character {0} {1} but they are already in the set!", | ||
1737 | chr.Name, chr.LocalID); | ||
1733 | } | 1738 | } |
1734 | } | 1739 | } |
1735 | 1740 | ||
1736 | internal void RemoveCharacter(OdeCharacter chr) | 1741 | internal void RemoveCharacter(OdeCharacter chr) |
1737 | { | 1742 | { |
1738 | _characters.Remove(chr); | 1743 | if (_characters.Contains(chr)) |
1744 | _characters.Remove(chr); | ||
1745 | else | ||
1746 | m_log.ErrorFormat( | ||
1747 | "[ODE SCENE]: Tried to remove character {0} {1} but they are not in the list!", | ||
1748 | chr.Name, chr.LocalID); | ||
1739 | } | 1749 | } |
1740 | 1750 | ||
1741 | private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, | 1751 | private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, |
@@ -2222,7 +2232,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2222 | //m_log.Warn(prim.prim_geom); | 2232 | //m_log.Warn(prim.prim_geom); |
2223 | 2233 | ||
2224 | if (!prim.RemoveGeom()) | 2234 | if (!prim.RemoveGeom()) |
2225 | m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene"); | 2235 | m_log.Warn("[ODE SCENE]: Unable to remove prim from physics scene"); |
2226 | 2236 | ||
2227 | lock (_prims) | 2237 | lock (_prims) |
2228 | _prims.Remove(prim); | 2238 | _prims.Remove(prim); |
@@ -2314,7 +2324,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2314 | } | 2324 | } |
2315 | else | 2325 | else |
2316 | { | 2326 | { |
2317 | m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + currentspace + | 2327 | m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" + currentspace + |
2318 | " Geom:" + geom); | 2328 | " Geom:" + geom); |
2319 | } | 2329 | } |
2320 | } | 2330 | } |
@@ -2330,7 +2340,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2330 | } | 2340 | } |
2331 | else | 2341 | else |
2332 | { | 2342 | { |
2333 | m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + | 2343 | m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" + |
2334 | sGeomIsIn + " Geom:" + geom); | 2344 | sGeomIsIn + " Geom:" + geom); |
2335 | } | 2345 | } |
2336 | } | 2346 | } |
@@ -2353,7 +2363,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2353 | } | 2363 | } |
2354 | else | 2364 | else |
2355 | { | 2365 | { |
2356 | m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + | 2366 | m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" + |
2357 | currentspace + " Geom:" + geom); | 2367 | currentspace + " Geom:" + geom); |
2358 | } | 2368 | } |
2359 | } | 2369 | } |
@@ -2373,7 +2383,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2373 | } | 2383 | } |
2374 | else | 2384 | else |
2375 | { | 2385 | { |
2376 | m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + | 2386 | m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" + |
2377 | currentspace + " Geom:" + geom); | 2387 | currentspace + " Geom:" + geom); |
2378 | } | 2388 | } |
2379 | } | 2389 | } |
@@ -2389,7 +2399,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2389 | } | 2399 | } |
2390 | else | 2400 | else |
2391 | { | 2401 | { |
2392 | m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + | 2402 | m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" + |
2393 | sGeomIsIn + " Geom:" + geom); | 2403 | sGeomIsIn + " Geom:" + geom); |
2394 | } | 2404 | } |
2395 | } | 2405 | } |
@@ -2633,7 +2643,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2633 | { | 2643 | { |
2634 | _taintedActors.Add(taintedchar); | 2644 | _taintedActors.Add(taintedchar); |
2635 | if (taintedchar.bad) | 2645 | if (taintedchar.bad) |
2636 | m_log.DebugFormat("[PHYSICS]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid); | 2646 | m_log.DebugFormat("[ODE SCENE]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid); |
2637 | } | 2647 | } |
2638 | } | 2648 | } |
2639 | } | 2649 | } |
@@ -2836,7 +2846,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2836 | } | 2846 | } |
2837 | catch (Exception e) | 2847 | catch (Exception e) |
2838 | { | 2848 | { |
2839 | m_log.ErrorFormat("[PHYSICS]: {0}, {1}, {2}", e.Message, e.TargetSite, e); | 2849 | m_log.ErrorFormat("[ODE SCENE]: {0}, {1}, {2}", e.Message, e.TargetSite, e); |
2840 | } | 2850 | } |
2841 | 2851 | ||
2842 | timeLeft -= ODE_STEPSIZE; | 2852 | timeLeft -= ODE_STEPSIZE; |
@@ -2845,7 +2855,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2845 | foreach (OdeCharacter actor in _characters) | 2855 | foreach (OdeCharacter actor in _characters) |
2846 | { | 2856 | { |
2847 | if (actor.bad) | 2857 | if (actor.bad) |
2848 | m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); | 2858 | m_log.WarnFormat("[ODE SCENE]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); |
2849 | 2859 | ||
2850 | actor.UpdatePositionAndVelocity(defects); | 2860 | actor.UpdatePositionAndVelocity(defects); |
2851 | } | 2861 | } |
@@ -3405,7 +3415,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
3405 | { | 3415 | { |
3406 | if (Single.IsNaN(resultarr2[y, x]) || Single.IsInfinity(resultarr2[y, x])) | 3416 | if (Single.IsNaN(resultarr2[y, x]) || Single.IsInfinity(resultarr2[y, x])) |
3407 | { | 3417 | { |
3408 | m_log.Warn("[PHYSICS]: Non finite heightfield element detected. Setting it to 0"); | 3418 | m_log.Warn("[ODE SCENE]: Non finite heightfield element detected. Setting it to 0"); |
3409 | resultarr2[y, x] = 0; | 3419 | resultarr2[y, x] = 0; |
3410 | } | 3420 | } |
3411 | returnarr[i] = resultarr2[y, x]; | 3421 | returnarr[i] = resultarr2[y, x]; |
@@ -3436,7 +3446,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
3436 | private void SetTerrain(float[] heightMap, Vector3 pOffset) | 3446 | private void SetTerrain(float[] heightMap, Vector3 pOffset) |
3437 | { | 3447 | { |
3438 | int startTime = Util.EnvironmentTickCount(); | 3448 | int startTime = Util.EnvironmentTickCount(); |
3439 | m_log.DebugFormat("[PHYSICS]: Setting terrain for {0}", Name); | 3449 | m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0}", Name); |
3440 | 3450 | ||
3441 | // this._heightmap[i] = (double)heightMap[i]; | 3451 | // this._heightmap[i] = (double)heightMap[i]; |
3442 | // dbm (danx0r) -- creating a buffer zone of one extra sample all around | 3452 | // dbm (danx0r) -- creating a buffer zone of one extra sample all around |
@@ -3561,7 +3571,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
3561 | } | 3571 | } |
3562 | 3572 | ||
3563 | m_log.DebugFormat( | 3573 | m_log.DebugFormat( |
3564 | "[PHYSICS]: Setting terrain for {0} took {1}ms", Name, Util.EnvironmentTickCountSubtract(startTime)); | 3574 | "[ODE SCENE]: Setting terrain for {0} took {1}ms", Name, Util.EnvironmentTickCountSubtract(startTime)); |
3565 | } | 3575 | } |
3566 | 3576 | ||
3567 | public override void DeleteTerrain() | 3577 | public override void DeleteTerrain() |