diff options
author | Justin Clark-Casey (justincc) | 2012-02-24 05:02:33 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-02-24 05:02:33 +0000 |
commit | f67f37074f3f7e0602b66aa66a044dd9fd107f6a (patch) | |
tree | f4e592451ab205b23075d423dab1a2a94dee5629 /OpenSim | |
parent | In osSetSpeed(), if no avatar for a uuid is found then don't attempt to set s... (diff) | |
download | opensim-SC-f67f37074f3f7e0602b66aa66a044dd9fd107f6a.zip opensim-SC-f67f37074f3f7e0602b66aa66a044dd9fd107f6a.tar.gz opensim-SC-f67f37074f3f7e0602b66aa66a044dd9fd107f6a.tar.bz2 opensim-SC-f67f37074f3f7e0602b66aa66a044dd9fd107f6a.tar.xz |
Stop spurious scene loop startup timeout alarms for scenes with many prims.
On the first frame, all startup scene objects are added to the physics scene.
This can cause a considerable delay, so we don't start raising the alarm on scene loop timeouts until the second frame.
This commit also slightly changes the behaviour of timeout reporting.
Previously, a report was made for the very first timed out thread, ignoring all others until the next watchdog check.
Instead, we now report every timed out thread, though we still only do this once no matter how long the timeout.
Diffstat (limited to '')
10 files changed, 65 insertions, 26 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 2206feb..0062d4e 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -65,6 +65,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
65 | String.Format("PollServiceWorkerThread{0}", i), | 65 | String.Format("PollServiceWorkerThread{0}", i), |
66 | ThreadPriority.Normal, | 66 | ThreadPriority.Normal, |
67 | false, | 67 | false, |
68 | true, | ||
68 | int.MaxValue); | 69 | int.MaxValue); |
69 | } | 70 | } |
70 | 71 | ||
@@ -73,6 +74,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
73 | "PollServiceWatcherThread", | 74 | "PollServiceWatcherThread", |
74 | ThreadPriority.Normal, | 75 | ThreadPriority.Normal, |
75 | false, | 76 | false, |
77 | true, | ||
76 | 1000 * 60 * 10); | 78 | 1000 * 60 * 10); |
77 | } | 79 | } |
78 | 80 | ||
diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 2dd6ebe..e443f0a 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs | |||
@@ -72,6 +72,11 @@ namespace OpenSim.Framework | |||
72 | /// </summary> | 72 | /// </summary> |
73 | public bool IsTimedOut { get; set; } | 73 | public bool IsTimedOut { get; set; } |
74 | 74 | ||
75 | /// <summary> | ||
76 | /// Will this thread trigger the alarm function if it has timed out? | ||
77 | /// </summary> | ||
78 | public bool AlarmIfTimeout { get; set; } | ||
79 | |||
75 | public ThreadWatchdogInfo(Thread thread, int timeout) | 80 | public ThreadWatchdogInfo(Thread thread, int timeout) |
76 | { | 81 | { |
77 | Thread = thread; | 82 | Thread = thread; |
@@ -112,12 +117,13 @@ namespace OpenSim.Framework | |||
112 | /// <param name="start">The method that will be executed in a new thread</param> | 117 | /// <param name="start">The method that will be executed in a new thread</param> |
113 | /// <param name="name">A name to give to the new thread</param> | 118 | /// <param name="name">A name to give to the new thread</param> |
114 | /// <param name="priority">Priority to run the thread at</param> | 119 | /// <param name="priority">Priority to run the thread at</param> |
115 | /// <param name="isBackground">True to run this thread as a background | 120 | /// <param name="isBackground">True to run this thread as a background thread, otherwise false</param> |
116 | /// thread, otherwise false</param> | 121 | /// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param> |
117 | /// <returns>The newly created Thread object</returns> | 122 | /// <returns>The newly created Thread object</returns> |
118 | public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground) | 123 | public static Thread StartThread( |
124 | ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout) | ||
119 | { | 125 | { |
120 | return StartThread(start, name, priority, isBackground, WATCHDOG_TIMEOUT_MS); | 126 | return StartThread(start, name, priority, isBackground, alarmIfTimeout, WATCHDOG_TIMEOUT_MS); |
121 | } | 127 | } |
122 | 128 | ||
123 | /// <summary> | 129 | /// <summary> |
@@ -128,21 +134,21 @@ namespace OpenSim.Framework | |||
128 | /// <param name="priority">Priority to run the thread at</param> | 134 | /// <param name="priority">Priority to run the thread at</param> |
129 | /// <param name="isBackground">True to run this thread as a background | 135 | /// <param name="isBackground">True to run this thread as a background |
130 | /// thread, otherwise false</param> | 136 | /// thread, otherwise false</param> |
131 | /// <param name="timeout"> | 137 | /// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param> |
132 | /// Number of milliseconds to wait until we issue a warning about timeout. | 138 | /// <param name="timeout">Number of milliseconds to wait until we issue a warning about timeout.</param> |
133 | /// </para> | ||
134 | /// <returns>The newly created Thread object</returns> | 139 | /// <returns>The newly created Thread object</returns> |
135 | public static Thread StartThread( | 140 | public static Thread StartThread( |
136 | ThreadStart start, string name, ThreadPriority priority, bool isBackground, int timeout) | 141 | ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout, int timeout) |
137 | { | 142 | { |
138 | Thread thread = new Thread(start); | 143 | Thread thread = new Thread(start); |
139 | thread.Name = name; | 144 | thread.Name = name; |
140 | thread.Priority = priority; | 145 | thread.Priority = priority; |
141 | thread.IsBackground = isBackground; | 146 | thread.IsBackground = isBackground; |
142 | 147 | ||
143 | ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout); | 148 | ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout) { AlarmIfTimeout = alarmIfTimeout }; |
144 | 149 | ||
145 | m_log.Debug("[WATCHDOG]: Started tracking thread \"" + twi.Thread.Name + "\" (ID " + twi.Thread.ManagedThreadId + ")"); | 150 | m_log.DebugFormat( |
151 | "[WATCHDOG]: Started tracking thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId); | ||
146 | 152 | ||
147 | lock (m_threads) | 153 | lock (m_threads) |
148 | m_threads.Add(twi.Thread.ManagedThreadId, twi); | 154 | m_threads.Add(twi.Thread.ManagedThreadId, twi); |
@@ -230,6 +236,26 @@ namespace OpenSim.Framework | |||
230 | return m_threads.Values.ToArray(); | 236 | return m_threads.Values.ToArray(); |
231 | } | 237 | } |
232 | 238 | ||
239 | /// <summary> | ||
240 | /// Return the current thread's watchdog info. | ||
241 | /// </summary> | ||
242 | /// <returns>The watchdog info. null if the thread isn't being monitored.</returns> | ||
243 | public static ThreadWatchdogInfo GetCurrentThreadInfo() | ||
244 | { | ||
245 | lock (m_threads) | ||
246 | { | ||
247 | if (m_threads.ContainsKey(Thread.CurrentThread.ManagedThreadId)) | ||
248 | return m_threads[Thread.CurrentThread.ManagedThreadId]; | ||
249 | } | ||
250 | |||
251 | return null; | ||
252 | } | ||
253 | |||
254 | /// <summary> | ||
255 | /// Check watched threads. Fire alarm if appropriate. | ||
256 | /// </summary> | ||
257 | /// <param name="sender"></param> | ||
258 | /// <param name="e"></param> | ||
233 | private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) | 259 | private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) |
234 | { | 260 | { |
235 | WatchdogTimeout callback = OnWatchdogTimeout; | 261 | WatchdogTimeout callback = OnWatchdogTimeout; |
@@ -246,21 +272,18 @@ namespace OpenSim.Framework | |||
246 | { | 272 | { |
247 | if (threadInfo.Thread.ThreadState == ThreadState.Stopped) | 273 | if (threadInfo.Thread.ThreadState == ThreadState.Stopped) |
248 | { | 274 | { |
249 | timedOut = threadInfo; | ||
250 | RemoveThread(threadInfo.Thread.ManagedThreadId); | 275 | RemoveThread(threadInfo.Thread.ManagedThreadId); |
251 | break; | 276 | callback(threadInfo.Thread, threadInfo.LastTick); |
252 | } | 277 | } |
253 | else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) | 278 | else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) |
254 | { | 279 | { |
255 | threadInfo.IsTimedOut = true; | 280 | threadInfo.IsTimedOut = true; |
256 | timedOut = threadInfo; | 281 | |
257 | break; | 282 | if (threadInfo.AlarmIfTimeout) |
283 | callback(threadInfo.Thread, threadInfo.LastTick); | ||
258 | } | 284 | } |
259 | } | 285 | } |
260 | } | 286 | } |
261 | |||
262 | if (timedOut != null) | ||
263 | callback(timedOut.Thread, timedOut.LastTick); | ||
264 | } | 287 | } |
265 | 288 | ||
266 | m_watchdogTimer.Start(); | 289 | m_watchdogTimer.Start(); |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 1e22fcc..fb6b11e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -244,8 +244,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
244 | base.Start(m_recvBufferSize, m_asyncPacketHandling); | 244 | base.Start(m_recvBufferSize, m_asyncPacketHandling); |
245 | 245 | ||
246 | // Start the packet processing threads | 246 | // Start the packet processing threads |
247 | Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); | 247 | Watchdog.StartThread( |
248 | Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); | 248 | IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true); |
249 | Watchdog.StartThread( | ||
250 | OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true); | ||
251 | |||
249 | m_elapsedMSSinceLastStatReport = Environment.TickCount; | 252 | m_elapsedMSSinceLastStatReport = Environment.TickCount; |
250 | } | 253 | } |
251 | 254 | ||
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index f367739..a6e2548 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | |||
@@ -1210,7 +1210,7 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
1210 | if (homeScene.TryGetScenePresence(avatarId,out avatar)) | 1210 | if (homeScene.TryGetScenePresence(avatarId,out avatar)) |
1211 | { | 1211 | { |
1212 | KillAUser ku = new KillAUser(avatar,mod); | 1212 | KillAUser ku = new KillAUser(avatar,mod); |
1213 | Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); | 1213 | Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true); |
1214 | } | 1214 | } |
1215 | } | 1215 | } |
1216 | 1216 | ||
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index b315d2c..74b047b 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -351,6 +351,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
351 | process, | 351 | process, |
352 | string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), | 352 | string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), |
353 | ThreadPriority.BelowNormal, | 353 | ThreadPriority.BelowNormal, |
354 | true, | ||
354 | true); | 355 | true); |
355 | } | 356 | } |
356 | 357 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cf6e6af..19d4bad 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1140,7 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1140 | 1140 | ||
1141 | HeartbeatThread | 1141 | HeartbeatThread |
1142 | = Watchdog.StartThread( | 1142 | = Watchdog.StartThread( |
1143 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false); | 1143 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | /// <summary> | 1146 | /// <summary> |
@@ -1178,6 +1178,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1178 | try | 1178 | try |
1179 | { | 1179 | { |
1180 | m_eventManager.TriggerOnRegionStarted(this); | 1180 | m_eventManager.TriggerOnRegionStarted(this); |
1181 | |||
1182 | // The first frame can take a very long time due to physics actors being added on startup. Therefore, | ||
1183 | // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false | ||
1184 | // alarms for scenes with many objects. | ||
1185 | Update(); | ||
1186 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; | ||
1187 | |||
1181 | while (!shuttingdown) | 1188 | while (!shuttingdown) |
1182 | Update(); | 1189 | Update(); |
1183 | 1190 | ||
@@ -1206,7 +1213,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1206 | 1213 | ||
1207 | ++Frame; | 1214 | ++Frame; |
1208 | 1215 | ||
1209 | // m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame); | 1216 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1210 | 1217 | ||
1211 | try | 1218 | try |
1212 | { | 1219 | { |
@@ -1418,7 +1425,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1418 | entry.checkAtTargets(); | 1425 | entry.checkAtTargets(); |
1419 | } | 1426 | } |
1420 | 1427 | ||
1421 | |||
1422 | /// <summary> | 1428 | /// <summary> |
1423 | /// Send out simstats data to all clients | 1429 | /// Send out simstats data to all clients |
1424 | /// </summary> | 1430 | /// </summary> |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index c928af7..d3c96e2 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
70 | m_client = client; | 70 | m_client = client; |
71 | m_scene = scene; | 71 | m_scene = scene; |
72 | 72 | ||
73 | Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false); | 73 | Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true); |
74 | } | 74 | } |
75 | 75 | ||
76 | private void SendServerCommand(string command) | 76 | private void SendServerCommand(string command) |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index eb39026..a7c5020 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | |||
@@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
57 | 57 | ||
58 | m_listener.Start(50); | 58 | m_listener.Start(50); |
59 | 59 | ||
60 | Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false); | 60 | Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true); |
61 | m_baseScene = baseScene; | 61 | m_baseScene = baseScene; |
62 | } | 62 | } |
63 | 63 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 75364b7..97890ee 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -1474,6 +1474,8 @@ Console.WriteLine("CreateGeom:"); | |||
1474 | /// </summary> | 1474 | /// </summary> |
1475 | private void changeadd() | 1475 | private void changeadd() |
1476 | { | 1476 | { |
1477 | // m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name); | ||
1478 | |||
1477 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); | 1479 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); |
1478 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); | 1480 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); |
1479 | 1481 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index ee32755..14edde4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs | |||
@@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
137 | if (cmdHandlerThread == null) | 137 | if (cmdHandlerThread == null) |
138 | { | 138 | { |
139 | // Start the thread that will be doing the work | 139 | // Start the thread that will be doing the work |
140 | cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true); | 140 | cmdHandlerThread |
141 | = Watchdog.StartThread( | ||
142 | CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true); | ||
141 | } | 143 | } |
142 | } | 144 | } |
143 | 145 | ||