diff options
author | Melanie | 2010-11-28 20:45:03 +0100 |
---|---|---|
committer | Melanie | 2010-11-28 20:45:03 +0100 |
commit | 2bee150aac6d4996140ddf1f9bd09ba444901033 (patch) | |
tree | 389b2fe3b92b907dec836e828180e2877871a4a4 /OpenSim | |
parent | Implement god summons (diff) | |
download | opensim-SC_OLD-2bee150aac6d4996140ddf1f9bd09ba444901033.zip opensim-SC_OLD-2bee150aac6d4996140ddf1f9bd09ba444901033.tar.gz opensim-SC_OLD-2bee150aac6d4996140ddf1f9bd09ba444901033.tar.bz2 opensim-SC_OLD-2bee150aac6d4996140ddf1f9bd09ba444901033.tar.xz |
Implement health monitoring of the packet receiving and sending threads
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 39 |
2 files changed, 38 insertions, 3 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 59968a1..ef0a178 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -946,6 +946,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
946 | 946 | ||
947 | while (base.IsRunning) | 947 | while (base.IsRunning) |
948 | { | 948 | { |
949 | m_scene.ThreadAlive(1); | ||
949 | try | 950 | try |
950 | { | 951 | { |
951 | IncomingPacket incomingPacket = null; | 952 | IncomingPacket incomingPacket = null; |
@@ -988,6 +989,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
988 | 989 | ||
989 | while (base.IsRunning) | 990 | while (base.IsRunning) |
990 | { | 991 | { |
992 | m_scene.ThreadAlive(2); | ||
991 | try | 993 | try |
992 | { | 994 | { |
993 | m_packetSent = false; | 995 | m_packetSent = false; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 216eb51..83887b4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -174,6 +174,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
174 | private volatile bool shuttingdown; | 174 | private volatile bool shuttingdown; |
175 | 175 | ||
176 | private int m_lastUpdate; | 176 | private int m_lastUpdate; |
177 | private int m_lastIncoming; | ||
178 | private int m_lastOutgoing; | ||
177 | private bool m_firstHeartbeat = true; | 179 | private bool m_firstHeartbeat = true; |
178 | 180 | ||
179 | private object m_deleting_scene_object = new object(); | 181 | private object m_deleting_scene_object = new object(); |
@@ -567,6 +569,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
567 | m_regionName = m_regInfo.RegionName; | 569 | m_regionName = m_regInfo.RegionName; |
568 | m_datastore = m_regInfo.DataStore; | 570 | m_datastore = m_regInfo.DataStore; |
569 | m_lastUpdate = Util.EnvironmentTickCount(); | 571 | m_lastUpdate = Util.EnvironmentTickCount(); |
572 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
573 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
570 | 574 | ||
571 | m_physicalPrim = physicalPrim; | 575 | m_physicalPrim = physicalPrim; |
572 | m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; | 576 | m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; |
@@ -4543,11 +4547,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4543 | // 1 = sim is up and accepting http requests. The heartbeat has | 4547 | // 1 = sim is up and accepting http requests. The heartbeat has |
4544 | // stopped and the sim is probably locked up, but a remote | 4548 | // stopped and the sim is probably locked up, but a remote |
4545 | // admin restart may succeed | 4549 | // admin restart may succeed |
4546 | // | 4550 | // |
4547 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 4551 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4548 | // usable for people within and logins _may_ work | 4552 | // usable for people within |
4553 | // | ||
4554 | // 3 = Sim is up and one packet thread is running. Sim is | ||
4555 | // unstable and will not accept new logins | ||
4556 | // | ||
4557 | // 4 = Sim is up and both packet threads are running. Sim is | ||
4558 | // likely usable | ||
4549 | // | 4559 | // |
4550 | // 3 = We have seen a new user enter within the past 4 minutes | 4560 | // 5 = We have seen a new user enter within the past 4 minutes |
4551 | // which can be seen as positive confirmation of sim health | 4561 | // which can be seen as positive confirmation of sim health |
4552 | // | 4562 | // |
4553 | int health=1; // Start at 1, means we're up | 4563 | int health=1; // Start at 1, means we're up |
@@ -4557,6 +4567,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4557 | else | 4567 | else |
4558 | return health; | 4568 | return health; |
4559 | 4569 | ||
4570 | if (m_firstHeartbeat || ((Util.EnvironmentTickCountSubtract(m_lastIncoming)) < 1000)) | ||
4571 | health+=1; | ||
4572 | else | ||
4573 | return health; | ||
4574 | |||
4575 | if (m_firstHeartbeat || ((Util.EnvironmentTickCountSubtract(m_lastOutgoing)) < 1000)) | ||
4576 | health+=1; | ||
4577 | else | ||
4578 | return health; | ||
4579 | |||
4560 | // A login in the last 4 mins? We can't be doing too badly | 4580 | // A login in the last 4 mins? We can't be doing too badly |
4561 | // | 4581 | // |
4562 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 4582 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) |
@@ -5106,5 +5126,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
5106 | m_log.Debug("[SCENE]: Finished dropped attachment deletion"); | 5126 | m_log.Debug("[SCENE]: Finished dropped attachment deletion"); |
5107 | } | 5127 | } |
5108 | } | 5128 | } |
5129 | |||
5130 | public void ThreadAlive(int threadCode) | ||
5131 | { | ||
5132 | switch(threadCode) | ||
5133 | { | ||
5134 | case 1: // Incoming | ||
5135 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5136 | break; | ||
5137 | case 2: // Incoming | ||
5138 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5139 | break; | ||
5140 | } | ||
5141 | } | ||
5109 | } | 5142 | } |
5110 | } | 5143 | } |