Alleviate an issue where calling Thread.Abort() on script WorkItems can fail to release locks, resulting in a crippled simulator.

This seems to be a particular problem with ReaderWriterLockSlim, though other locks can be affected as well.
It has been seen to happen when llDie() is called in a linkset running more than one script.
Alleviation here means supplying a ScriptInstance.Stop() timeout of 1000ms rather than 0ms, to give events a chance to complete.
Also, we check the IsRunning status at the top of the ScriptInstance.EventProcessor() so that another event doesn't start in the mean time.
Ultimately, a better solution may have to be found since a long-running event would still exceed the timeout and be aborted.
This commit is contained in:
Justin Clark-Casey (justincc)
2012-03-15 00:06:52 +00:00
parent d6dd3c42d1
commit 12cebb12d5
2 changed files with 15 additions and 4 deletions

View File

@@ -1118,7 +1118,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
instance.ClearQueue();
instance.Stop(0);
// Give the script some time to finish processing its last event. Simply aborting the script thread can
// cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort.
instance.Stop(1000);
// bool objectRemoved = false;
lock (m_PrimObjects)