diff options
author | unknown | 2009-10-23 03:52:49 -0700 |
---|---|---|
committer | Melanie | 2009-10-23 11:25:06 +0100 |
commit | 71c929137f48a0a7d97dbc866cbe2b12319aa40b (patch) | |
tree | d06fa40f9d203b9d1333412672cacd2f334a0a10 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Fix a glitch in a ROBUST message (diff) | |
download | opensim-SC-71c929137f48a0a7d97dbc866cbe2b12319aa40b.zip opensim-SC-71c929137f48a0a7d97dbc866cbe2b12319aa40b.tar.gz opensim-SC-71c929137f48a0a7d97dbc866cbe2b12319aa40b.tar.bz2 opensim-SC-71c929137f48a0a7d97dbc866cbe2b12319aa40b.tar.xz |
Inconsistent locking of SenseRepeaters in Script Engine.
When I attempt to 'save oar' on a region with thousands of scripts with timers, I get a NullReferenceException every time. The problem comes from inconsistent locking in SensorRepeat.cs of the SenseRepeaters List. It is iterated and modified in many places and these places are all wrapped in a lock except in the GetSerializationData(). This is the function throwing the exception because an item in the list becomes null during iteration.
The attached patch locks SenseRepeatListLock in GetSerializationData()
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index ee01c3c..b75a2e4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -516,16 +516,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
516 | { | 516 | { |
517 | List<Object> data = new List<Object>(); | 517 | List<Object> data = new List<Object>(); |
518 | 518 | ||
519 | foreach (SenseRepeatClass ts in SenseRepeaters) | 519 | lock (SenseRepeatListLock) |
520 | { | 520 | { |
521 | if (ts.itemID == itemID) | 521 | foreach (SenseRepeatClass ts in SenseRepeaters) |
522 | { | 522 | { |
523 | data.Add(ts.interval); | 523 | if (ts.itemID == itemID) |
524 | data.Add(ts.name); | 524 | { |
525 | data.Add(ts.keyID); | 525 | data.Add(ts.interval); |
526 | data.Add(ts.type); | 526 | data.Add(ts.name); |
527 | data.Add(ts.range); | 527 | data.Add(ts.keyID); |
528 | data.Add(ts.arc); | 528 | data.Add(ts.type); |
529 | data.Add(ts.range); | ||
530 | data.Add(ts.arc); | ||
531 | } | ||
529 | } | 532 | } |
530 | } | 533 | } |
531 | return data.ToArray(); | 534 | return data.ToArray(); |