Avoid a race condition between the scene shutdown thread and the update thread since commit c150320
(Thu Jul 26 15:27:18 2012)
c150320
started explicitly disposing of the physics scene and nulling it out on region shutdown.
However, the update loop may not have yet checked Scene.ShuttingDown, particularly if avatars were not in the scene, causing failure when it tried to lookup time dilation.
This commit moves the setting of m_shuttingDown above the existing 500ms pause to notify avatars that they are being kicked.
This should not affect the few other places that use this flag.
0.7.4.1
parent
adbdb220df
commit
7e89b99e6a
|
@ -1199,15 +1199,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
avatar.ControllingClient.SendShutdownConnectionNotice();
|
avatar.ControllingClient.SendShutdownConnectionNotice();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Stop updating the scene objects and agents.
|
||||||
|
m_shuttingDown = true;
|
||||||
|
|
||||||
// Wait here, or the kick messages won't actually get to the agents before the scene terminates.
|
// Wait here, or the kick messages won't actually get to the agents before the scene terminates.
|
||||||
|
// We also need to wait to avoid a race condition with the scene update loop which might not yet
|
||||||
|
// have checked ShuttingDown.
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
|
|
||||||
// Stop all client threads.
|
// Stop all client threads.
|
||||||
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
|
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
|
||||||
|
|
||||||
// Stop updating the scene objects and agents.
|
|
||||||
m_shuttingDown = true;
|
|
||||||
|
|
||||||
m_log.Debug("[SCENE]: Persisting changed objects");
|
m_log.Debug("[SCENE]: Persisting changed objects");
|
||||||
EventManager.TriggerSceneShuttingDown(this);
|
EventManager.TriggerSceneShuttingDown(this);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue