aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs1
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs27
-rw-r--r--OpenSim/Framework/Tests/ThreadTrackerTests.cs140
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs1
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs1
-rw-r--r--OpenSim/TestSuite/BotManager.cs1
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs1
14 files changed, 8 insertions, 173 deletions
diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
index 332ff70..4910ab1 100644
--- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
+++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
@@ -89,7 +89,6 @@ namespace OpenSim.Client.MXP.PacketHandler
89 m_clientThread.Name = "MXPThread"; 89 m_clientThread.Name = "MXPThread";
90 m_clientThread.IsBackground = true; 90 m_clientThread.IsBackground = true;
91 m_clientThread.Start(); 91 m_clientThread.Start();
92 ThreadTracker.Add(m_clientThread);
93 } 92 }
94 93
95 public void StartListener() 94 public void StartListener()
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 56155dd..8e58980 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics;
30using System.IO; 31using System.IO;
31using System.Reflection; 32using System.Reflection;
32using System.Text; 33using System.Text;
@@ -109,9 +110,8 @@ namespace OpenSim.Framework.Servers
109 m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); 110 m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
110 m_periodicDiagnosticsTimer.Enabled = true; 111 m_periodicDiagnosticsTimer.Enabled = true;
111 112
112 // Add ourselves to thread monitoring. This thread will go on to become the console listening thread 113 // This thread will go on to become the console listening thread
113 Thread.CurrentThread.Name = "ConsoleThread"; 114 Thread.CurrentThread.Name = "ConsoleThread";
114 ThreadTracker.Add(Thread.CurrentThread);
115 115
116 ILoggerRepository repository = LogManager.GetRepository(); 116 ILoggerRepository repository = LogManager.GetRepository();
117 IAppender[] appenders = repository.GetAppenders(); 117 IAppender[] appenders = repository.GetAppenders();
@@ -235,7 +235,7 @@ namespace OpenSim.Framework.Servers
235 { 235 {
236 StringBuilder sb = new StringBuilder(); 236 StringBuilder sb = new StringBuilder();
237 237
238 List<Thread> threads = ThreadTracker.GetThreads(); 238 ProcessThreadCollection threads = ThreadTracker.GetThreads();
239 if (threads == null) 239 if (threads == null)
240 { 240 {
241 sb.Append("OpenSim thread tracking is only enabled in DEBUG mode."); 241 sb.Append("OpenSim thread tracking is only enabled in DEBUG mode.");
@@ -243,25 +243,10 @@ namespace OpenSim.Framework.Servers
243 else 243 else
244 { 244 {
245 sb.Append(threads.Count + " threads are being tracked:" + Environment.NewLine); 245 sb.Append(threads.Count + " threads are being tracked:" + Environment.NewLine);
246 foreach (Thread t in threads) 246 foreach (ProcessThread t in threads)
247 { 247 {
248 if (t.IsAlive) 248 sb.Append("ID: " + t.Id + ", TotalProcessorTime: " + t.TotalProcessorTime + ", TimeRunning: " +
249 { 249 (DateTime.Now - t.StartTime) + ", Pri: " + t.CurrentPriority + ", State: " + t.ThreadState + Environment.NewLine);
250 sb.Append(
251 "ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", Alive: " + t.IsAlive
252 + ", Pri: " + t.Priority + ", State: " + t.ThreadState + Environment.NewLine);
253 }
254 else
255 {
256 try
257 {
258 sb.Append("ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", DEAD" + Environment.NewLine);
259 }
260 catch
261 {
262 sb.Append("THREAD ERROR" + Environment.NewLine);
263 }
264 }
265 } 250 }
266 } 251 }
267 int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0; 252 int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0;
diff --git a/OpenSim/Framework/Tests/ThreadTrackerTests.cs b/OpenSim/Framework/Tests/ThreadTrackerTests.cs
index 15d5b73..7eb83e6 100644
--- a/OpenSim/Framework/Tests/ThreadTrackerTests.cs
+++ b/OpenSim/Framework/Tests/ThreadTrackerTests.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Framework.Tests
41 [Test] 41 [Test]
42 public void DefaultThreadTrackerTest() 42 public void DefaultThreadTrackerTest()
43 { 43 {
44 List<Thread> lThread = ThreadTracker.GetThreads(); 44 System.Diagnostics.ProcessThreadCollection lThread = ThreadTracker.GetThreads();
45 45
46 /* 46 /*
47 foreach (Thread t in lThread) 47 foreach (Thread t in lThread)
@@ -50,143 +50,7 @@ namespace OpenSim.Framework.Tests
50 } 50 }
51 */ 51 */
52 52
53 Assert.That(lThread.Count == 1); 53 Assert.That(lThread.Count > 0);
54 Assert.That(lThread[0].Name == "ThreadTrackerThread");
55 } 54 }
56
57 /// <summary>
58 /// Validate that adding a thread to the thread tracker works
59 /// Validate that removing a thread from the thread tracker also works.
60 /// </summary>
61 [Test]
62 public void AddThreadToThreadTrackerTestAndRemoveTest()
63 {
64 Thread t = new Thread(run);
65 t.Name = "TestThread";
66 t.Priority = ThreadPriority.BelowNormal;
67 t.IsBackground = true;
68 t.SetApartmentState(ApartmentState.MTA);
69 t.Start();
70 ThreadTracker.Add(t);
71
72 List<Thread> lThread = ThreadTracker.GetThreads();
73
74 Assert.That(lThread.Count == 2);
75
76 foreach (Thread tr in lThread)
77 {
78 Assert.That((tr.Name == "ThreadTrackerThread" || tr.Name == "TestThread"));
79 }
80 running = false;
81 ThreadTracker.Remove(t);
82
83 lThread = ThreadTracker.GetThreads();
84
85 Assert.That(lThread.Count == 1);
86
87 foreach (Thread tr in lThread)
88 {
89 Assert.That((tr.Name == "ThreadTrackerThread"));
90 }
91
92
93 }
94
95 /// <summary>
96 /// Test a dead thread removal by aborting it and setting it's last seen active date to 50 seconds
97 /// </summary>
98 [Test]
99 public void DeadThreadTest()
100 {
101 Thread t = new Thread(run2);
102 t.Name = "TestThread";
103 t.Priority = ThreadPriority.BelowNormal;
104 t.IsBackground = true;
105 t.SetApartmentState(ApartmentState.MTA);
106 t.Start();
107 ThreadTracker.Add(t);
108 t.Abort();
109 Thread.Sleep(5000);
110 ThreadTracker.m_Threads[1].LastSeenActive = DateTime.Now.Ticks - (50*10000000);
111 ThreadTracker.CleanUp();
112 List<Thread> lThread = ThreadTracker.GetThreads();
113
114 Assert.That(lThread.Count == 1);
115
116 foreach (Thread tr in lThread)
117 {
118 Assert.That((tr.Name == "ThreadTrackerThread"));
119 }
120 }
121
122 [Test]
123 public void UnstartedThreadTest()
124 {
125 Thread t = new Thread(run2);
126 t.Name = "TestThread";
127 t.Priority = ThreadPriority.BelowNormal;
128 t.IsBackground = true;
129 t.SetApartmentState(ApartmentState.MTA);
130 ThreadTracker.Add(t);
131 ThreadTracker.m_Threads[1].LastSeenActive = DateTime.Now.Ticks - (50 * 10000000);
132 ThreadTracker.CleanUp();
133 List<Thread> lThread = ThreadTracker.GetThreads();
134
135 Assert.That(lThread.Count == 1);
136
137 foreach (Thread tr in lThread)
138 {
139 Assert.That((tr.Name == "ThreadTrackerThread"));
140 }
141 }
142
143 [Test]
144 public void NullThreadTest()
145 {
146 Thread t = null;
147 ThreadTracker.Add(t);
148
149 List<Thread> lThread = ThreadTracker.GetThreads();
150
151 Assert.That(lThread.Count == 1);
152
153 foreach (Thread tr in lThread)
154 {
155 Assert.That((tr.Name == "ThreadTrackerThread"));
156 }
157 }
158
159
160 /// <summary>
161 /// Worker thread 0
162 /// </summary>
163 /// <param name="o"></param>
164 public void run(object o)
165 {
166 while (running)
167 {
168 Thread.Sleep(5000);
169 }
170 }
171
172 /// <summary>
173 /// Worker thread 1
174 /// </summary>
175 /// <param name="o"></param>
176 public void run2(object o)
177 {
178 try
179 {
180 while (running2)
181 {
182 Thread.Sleep(5000);
183 }
184
185 }
186 catch (ThreadAbortException)
187 {
188 }
189 }
190
191 } 55 }
192} 56}
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index 45e724d..d78931a 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -323,7 +323,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
323 httpThread.IsBackground = true; 323 httpThread.IsBackground = true;
324 _finished = false; 324 _finished = false;
325 httpThread.Start(); 325 httpThread.Start();
326 ThreadTracker.Add(httpThread);
327 } 326 }
328 327
329 /* 328 /*
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index 8a169f8..97899a7 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -639,7 +639,6 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
639 httpThread.IsBackground = true; 639 httpThread.IsBackground = true;
640 _finished = false; 640 _finished = false;
641 httpThread.Start(); 641 httpThread.Start();
642 ThreadTracker.Add(httpThread);
643 } 642 }
644 643
645 /* 644 /*
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 05ed70a..4fb4c51 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -345,7 +345,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
345 mapItemReqThread.Priority = ThreadPriority.BelowNormal; 345 mapItemReqThread.Priority = ThreadPriority.BelowNormal;
346 mapItemReqThread.SetApartmentState(ApartmentState.MTA); 346 mapItemReqThread.SetApartmentState(ApartmentState.MTA);
347 mapItemReqThread.Start(); 347 mapItemReqThread.Start();
348 ThreadTracker.Add(mapItemReqThread);
349 } 348 }
350 349
351 /// <summary> 350 /// <summary>
@@ -447,7 +446,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
447 // end gracefully 446 // end gracefully
448 if (st.agentID == UUID.Zero) 447 if (st.agentID == UUID.Zero)
449 { 448 {
450 ThreadTracker.Remove(mapItemReqThread);
451 break; 449 break;
452 } 450 }
453 451
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 606135b..30c2223 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -901,7 +901,6 @@ namespace OpenSim.Region.Framework.Scenes
901 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); 901 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
902 if (HeartbeatThread != null) 902 if (HeartbeatThread != null)
903 { 903 {
904 ThreadTracker.Remove(HeartbeatThread);
905 HeartbeatThread.Abort(); 904 HeartbeatThread.Abort();
906 HeartbeatThread = null; 905 HeartbeatThread = null;
907 } 906 }
@@ -910,7 +909,6 @@ namespace OpenSim.Region.Framework.Scenes
910 HeartbeatThread.SetApartmentState(ApartmentState.MTA); 909 HeartbeatThread.SetApartmentState(ApartmentState.MTA);
911 HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName); 910 HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName);
912 HeartbeatThread.Priority = ThreadPriority.AboveNormal; 911 HeartbeatThread.Priority = ThreadPriority.AboveNormal;
913 ThreadTracker.Add(HeartbeatThread);
914 HeartbeatThread.Start(); 912 HeartbeatThread.Start();
915 } 913 }
916 914
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
index 9273fb5..cd401a6 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
@@ -360,7 +360,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
360 m_listener.Name = "IRCConnectorListenerThread"; 360 m_listener.Name = "IRCConnectorListenerThread";
361 m_listener.IsBackground = true; 361 m_listener.IsBackground = true;
362 m_listener.Start(); 362 m_listener.Start();
363 ThreadTracker.Add(m_listener);
364 363
365 // This is the message order recommended by RFC 2812 364 // This is the message order recommended by RFC 2812
366 if (m_password != null) 365 if (m_password != null)
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs
index 7202601..16fe9e9 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs
@@ -152,7 +152,6 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
152 m_thread.Name = "Content Management"; 152 m_thread.Name = "Content Management";
153 m_thread.IsBackground = true; 153 m_thread.IsBackground = true;
154 m_thread.Start(); 154 m_thread.Start();
155 ThreadTracker.Add(m_thread);
156 m_state = State.NONE; 155 m_state = State.NONE;
157 } 156 }
158 } 157 }
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
index 0feb967..583d2ff 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
@@ -138,7 +138,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
138 EventQueueThread.Priority = MyThreadPriority; 138 EventQueueThread.Priority = MyThreadPriority;
139 EventQueueThread.Name = "EventQueueManagerThread_" + ThreadCount; 139 EventQueueThread.Name = "EventQueueManagerThread_" + ThreadCount;
140 EventQueueThread.Start(); 140 EventQueueThread.Start();
141 ThreadTracker.Add(EventQueueThread);
142 141
143 // Look at this... Don't you wish everyone did that solid 142 // Look at this... Don't you wish everyone did that solid
144 // coding everywhere? :P 143 // coding everywhere? :P
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
index 8bafe77..7ffdb1a 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/MaintenanceThread.cs
@@ -97,7 +97,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
97 MaintenanceThreadThread.Name = "ScriptMaintenanceThread"; 97 MaintenanceThreadThread.Name = "ScriptMaintenanceThread";
98 MaintenanceThreadThread.IsBackground = true; 98 MaintenanceThreadThread.IsBackground = true;
99 MaintenanceThreadThread.Start(); 99 MaintenanceThreadThread.Start();
100 ThreadTracker.Add(MaintenanceThreadThread);
101 } 100 }
102 } 101 }
103 102
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index e454524..1607d34 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -142,7 +142,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
142 cmdHandlerThread.Priority = ThreadPriority.BelowNormal; 142 cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
143 cmdHandlerThread.IsBackground = true; 143 cmdHandlerThread.IsBackground = true;
144 cmdHandlerThread.Start(); 144 cmdHandlerThread.Start();
145 ThreadTracker.Add(cmdHandlerThread);
146 } 145 }
147 } 146 }
148 147
diff --git a/OpenSim/TestSuite/BotManager.cs b/OpenSim/TestSuite/BotManager.cs
index 62e0ec7..55ba687 100644
--- a/OpenSim/TestSuite/BotManager.cs
+++ b/OpenSim/TestSuite/BotManager.cs
@@ -115,7 +115,6 @@ namespace OpenSim.TestSuite
115 m_td[pos].IsBackground = true; 115 m_td[pos].IsBackground = true;
116 m_td[pos].Start(); 116 m_td[pos].Start();
117 m_lBot.Add(pb); 117 m_lBot.Add(pb);
118 ThreadTracker.Add(m_td[pos]);
119 } 118 }
120 119
121 /// <summary> 120 /// <summary>
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 3f4e6ed..614b350 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -149,7 +149,6 @@ namespace pCampBot
149 m_td[pos].IsBackground = true; 149 m_td[pos].IsBackground = true;
150 m_td[pos].Start(); 150 m_td[pos].Start();
151 m_lBot.Add(pb); 151 m_lBot.Add(pb);
152 ThreadTracker.Add(m_td[pos]);
153 } 152 }
154 153
155 /// <summary> 154 /// <summary>