From 3a1ee79ee4239213b35f6b73a65c127c2af977fb Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 27 Oct 2009 02:36:57 -0700 Subject: [PATCH] Finally hunted down the Parallel deadlock. Packets were being handled asynchronously (filling up the threadpool with handlers), which would turn around and try to do parallel operations on the starved threadpool. The solution for now is to disable Parallel.cs operations until we can gracefully handle parallel operations with a potentially starved threadpool --- OpenSim/Region/Framework/Scenes/Scene.cs | 15 +++++++++------ bin/OpenSim.ini.example | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6c34056605..42051d07e1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -120,7 +120,7 @@ namespace OpenSim.Region.Framework.Scenes private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing private int m_incrementsof15seconds; private volatile bool m_backingup; - private bool m_useAsyncWhenPossible = true; + private bool m_useAsyncWhenPossible; private Dictionary m_returns = new Dictionary(); private Dictionary m_groupsWithTargets = new Dictionary(); @@ -480,7 +480,7 @@ namespace OpenSim.Region.Framework.Scenes IConfig startupConfig = m_config.Configs["Startup"]; // Should we try to run loops synchronously or asynchronously? - m_useAsyncWhenPossible = startupConfig.GetBoolean("use_async_when_possible", true); + m_useAsyncWhenPossible = startupConfig.GetBoolean("use_async_when_possible", false); //Animation states m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); @@ -4261,10 +4261,13 @@ namespace OpenSim.Region.Framework.Scenes public void ForEachClient(Action action, bool doAsynchronous) { - if (doAsynchronous) - m_clientManager.ForEach(action); - else - m_clientManager.ForEachSync(action); + // FIXME: Asynchronous iteration is disabled until we have a threading model that + // can support calling this function from an async packet handler without + // potentially deadlocking + //if (doAsynchronous) + // m_clientManager.ForEach(action); + //else + // m_clientManager.ForEachSync(action); } public bool TryGetClient(UUID avatarID, out IClientAPI client) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 2adc87f440..4f1799e94c 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -49,7 +49,7 @@ ; in parallel. Running in parallel should increase performance ; on a multi-core system, but will make debugging more ; difficult if something deadlocks or times out - use_async_when_possible = true + use_async_when_possible = false ; Max threads to allocate on the FireAndForget thread pool ; when running with the SmartThreadPool option above