diff options
author | Teravus Ovares (Dan Olivares) | 2009-09-09 16:20:19 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-09-09 16:20:19 -0400 |
commit | c605509da3a690d4050c48418111d7f29f7be9b4 (patch) | |
tree | e2e76c5e521577c9be9002530d289a4b346f2907 | |
parent | Merge branch 'master' of ssh://MyConnection/var/git/opensim (diff) | |
download | opensim-SC_OLD-c605509da3a690d4050c48418111d7f29f7be9b4.zip opensim-SC_OLD-c605509da3a690d4050c48418111d7f29f7be9b4.tar.gz opensim-SC_OLD-c605509da3a690d4050c48418111d7f29f7be9b4.tar.bz2 opensim-SC_OLD-c605509da3a690d4050c48418111d7f29f7be9b4.tar.xz |
* Lock timers when Calling Start() and Stop() when the Thread Context is murky. This affects Mono only.
8 files changed, 85 insertions, 30 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 67ba016..7e0a4ba 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -384,7 +384,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
384 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing | 384 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing |
385 | shutdownTimer.AutoReset = false; | 385 | shutdownTimer.AutoReset = false; |
386 | shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); | 386 | shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); |
387 | shutdownTimer.Start(); | 387 | lock (shutdownTimer) |
388 | { | ||
389 | shutdownTimer.Start(); | ||
390 | } | ||
388 | 391 | ||
389 | responseData["success"] = true; | 392 | responseData["success"] = true; |
390 | } | 393 | } |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index 59431bb..4e03e67 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs | |||
@@ -2177,13 +2177,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
2177 | watchDog.Interval = interval; | 2177 | watchDog.Interval = interval; |
2178 | watchDog.AutoReset = false; | 2178 | watchDog.AutoReset = false; |
2179 | watchDog.Enabled = true; | 2179 | watchDog.Enabled = true; |
2180 | watchDog.Start(); | 2180 | lock (watchDog) |
2181 | watchDog.Start(); | ||
2182 | |||
2181 | } | 2183 | } |
2182 | 2184 | ||
2183 | internal void stopWD() | 2185 | internal void stopWD() |
2184 | { | 2186 | { |
2185 | Rest.Log.DebugFormat("{0} Reset watchdog", MsgId); | 2187 | Rest.Log.DebugFormat("{0} Reset watchdog", MsgId); |
2186 | watchDog.Stop(); | 2188 | lock (watchDog) |
2189 | watchDog.Stop(); | ||
2187 | } | 2190 | } |
2188 | 2191 | ||
2189 | /// <summary> | 2192 | /// <summary> |
diff --git a/OpenSim/Client/MXP/MXPModule.cs b/OpenSim/Client/MXP/MXPModule.cs index dbe4174..2d28b8c 100644 --- a/OpenSim/Client/MXP/MXPModule.cs +++ b/OpenSim/Client/MXP/MXPModule.cs | |||
@@ -81,7 +81,8 @@ namespace OpenSim.Client.MXP | |||
81 | m_ticker.AutoReset = false; | 81 | m_ticker.AutoReset = false; |
82 | m_ticker.Elapsed += ticker_Elapsed; | 82 | m_ticker.Elapsed += ticker_Elapsed; |
83 | 83 | ||
84 | m_ticker.Start(); | 84 | lock (m_ticker) |
85 | m_ticker.Start(); | ||
85 | 86 | ||
86 | m_log.Info("[MXP ClientStack] MXP Enabled and Listening"); | 87 | m_log.Info("[MXP ClientStack] MXP Enabled and Listening"); |
87 | } | 88 | } |
@@ -99,13 +100,17 @@ namespace OpenSim.Client.MXP | |||
99 | } | 100 | } |
100 | 101 | ||
101 | if (!m_shutdown) | 102 | if (!m_shutdown) |
102 | m_ticker.Start(); | 103 | { |
104 | lock (m_ticker) | ||
105 | m_ticker.Start(); | ||
106 | } | ||
103 | } | 107 | } |
104 | 108 | ||
105 | public void Close() | 109 | public void Close() |
106 | { | 110 | { |
107 | m_shutdown = true; | 111 | m_shutdown = true; |
108 | m_ticker.Stop(); | 112 | lock (m_ticker) |
113 | m_ticker.Stop(); | ||
109 | } | 114 | } |
110 | 115 | ||
111 | public string Name | 116 | public string Name |
diff --git a/OpenSim/Grid/MessagingServer.Modules/InterMessageUserServerModule.cs b/OpenSim/Grid/MessagingServer.Modules/InterMessageUserServerModule.cs index 0eb7b6a..ae04535 100644 --- a/OpenSim/Grid/MessagingServer.Modules/InterMessageUserServerModule.cs +++ b/OpenSim/Grid/MessagingServer.Modules/InterMessageUserServerModule.cs | |||
@@ -58,7 +58,8 @@ namespace OpenSim.Grid.MessagingServer.Modules | |||
58 | m_messageCore = messageCore; | 58 | m_messageCore = messageCore; |
59 | 59 | ||
60 | reconnectTimer.Elapsed += registerWithUserServer; | 60 | reconnectTimer.Elapsed += registerWithUserServer; |
61 | reconnectTimer.Start(); | 61 | lock (reconnectTimer) |
62 | reconnectTimer.Start(); | ||
62 | } | 63 | } |
63 | 64 | ||
64 | public void Initialise() | 65 | public void Initialise() |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index dd01780..dd50073 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -581,6 +581,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
581 | 581 | ||
582 | private void CloseCleanup(bool shutdownCircuit) | 582 | private void CloseCleanup(bool shutdownCircuit) |
583 | { | 583 | { |
584 | |||
585 | |||
584 | m_scene.RemoveClient(AgentId); | 586 | m_scene.RemoveClient(AgentId); |
585 | 587 | ||
586 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 588 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
@@ -592,12 +594,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
592 | 594 | ||
593 | Thread.Sleep(2000); | 595 | Thread.Sleep(2000); |
594 | 596 | ||
595 | // Shut down timers | 597 | // Shut down timers. Thread Context of this method is murky. Lock all timers |
596 | if (m_clientPingTimer.Enabled) m_clientPingTimer.Stop(); | 598 | if (m_clientPingTimer.Enabled) |
597 | if (m_avatarTerseUpdateTimer.Enabled) m_avatarTerseUpdateTimer.Stop(); | 599 | lock (m_clientPingTimer) |
598 | if (m_primTerseUpdateTimer.Enabled) m_primTerseUpdateTimer.Stop(); | 600 | m_clientPingTimer.Stop(); |
599 | if (m_primFullUpdateTimer.Enabled) m_primFullUpdateTimer.Stop(); | 601 | if (m_avatarTerseUpdateTimer.Enabled) |
600 | if (m_textureRequestTimer.Enabled) m_textureRequestTimer.Stop(); | 602 | lock (m_avatarTerseUpdateTimer) |
603 | m_avatarTerseUpdateTimer.Stop(); | ||
604 | if (m_primTerseUpdateTimer.Enabled) | ||
605 | lock (m_primTerseUpdateTimer) | ||
606 | m_primTerseUpdateTimer.Stop(); | ||
607 | if (m_primFullUpdateTimer.Enabled) | ||
608 | lock (m_primFullUpdateTimer) | ||
609 | m_primFullUpdateTimer.Stop(); | ||
610 | if (m_textureRequestTimer.Enabled) | ||
611 | lock (m_textureRequestTimer) | ||
612 | m_textureRequestTimer.Stop(); | ||
601 | 613 | ||
602 | // This is just to give the client a reasonable chance of | 614 | // This is just to give the client a reasonable chance of |
603 | // flushing out all it's packets. There should probably | 615 | // flushing out all it's packets. There should probably |
@@ -676,12 +688,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
676 | 688 | ||
677 | public void Stop() | 689 | public void Stop() |
678 | { | 690 | { |
679 | // Shut down timers | 691 | // Shut down timers. Thread Context is Murky, lock all timers! |
680 | if (m_clientPingTimer.Enabled) m_clientPingTimer.Stop(); | 692 | if (m_clientPingTimer.Enabled) |
681 | if (m_avatarTerseUpdateTimer.Enabled) m_avatarTerseUpdateTimer.Stop(); | 693 | lock (m_clientPingTimer) |
682 | if (m_primTerseUpdateTimer.Enabled) m_primTerseUpdateTimer.Stop(); | 694 | m_clientPingTimer.Stop(); |
683 | if (m_primFullUpdateTimer.Enabled) m_primFullUpdateTimer.Stop(); | 695 | |
684 | if (m_textureRequestTimer.Enabled) m_textureRequestTimer.Stop(); | 696 | if (m_avatarTerseUpdateTimer.Enabled) |
697 | lock (m_avatarTerseUpdateTimer) | ||
698 | m_avatarTerseUpdateTimer.Stop(); | ||
699 | |||
700 | if (m_primTerseUpdateTimer.Enabled) | ||
701 | lock (m_primTerseUpdateTimer) | ||
702 | m_primTerseUpdateTimer.Stop(); | ||
703 | |||
704 | if (m_primFullUpdateTimer.Enabled) | ||
705 | lock (m_primFullUpdateTimer) | ||
706 | m_primFullUpdateTimer.Stop(); | ||
707 | |||
708 | if (m_textureRequestTimer.Enabled) | ||
709 | lock (m_textureRequestTimer) | ||
710 | m_textureRequestTimer.Stop(); | ||
685 | } | 711 | } |
686 | 712 | ||
687 | public void Restart() | 713 | public void Restart() |
@@ -2907,7 +2933,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2907 | } | 2933 | } |
2908 | else if (m_avatarTerseUpdates.Count == 1) | 2934 | else if (m_avatarTerseUpdates.Count == 1) |
2909 | { | 2935 | { |
2910 | m_avatarTerseUpdateTimer.Start(); | 2936 | lock (m_avatarTerseUpdateTimer) |
2937 | m_avatarTerseUpdateTimer.Start(); | ||
2911 | } | 2938 | } |
2912 | } | 2939 | } |
2913 | } | 2940 | } |
@@ -2957,7 +2984,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2957 | OutPacket(terse, ThrottleOutPacketType.Task); | 2984 | OutPacket(terse, ThrottleOutPacketType.Task); |
2958 | 2985 | ||
2959 | if (m_avatarTerseUpdates.Count == 0) | 2986 | if (m_avatarTerseUpdates.Count == 0) |
2960 | m_avatarTerseUpdateTimer.Stop(); | 2987 | { |
2988 | lock (m_avatarTerseUpdateTimer) | ||
2989 | m_avatarTerseUpdateTimer.Stop(); | ||
2990 | } | ||
2961 | } | 2991 | } |
2962 | } | 2992 | } |
2963 | 2993 | ||
@@ -3138,7 +3168,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3138 | if (m_imageManager.ProcessImageQueue(m_textureSendLimit, | 3168 | if (m_imageManager.ProcessImageQueue(m_textureSendLimit, |
3139 | m_textureDataLimit)) | 3169 | m_textureDataLimit)) |
3140 | { | 3170 | { |
3141 | m_textureRequestTimer.Start(); | 3171 | lock(m_textureRequestTimer) |
3172 | m_textureRequestTimer.Start(); | ||
3142 | } | 3173 | } |
3143 | } | 3174 | } |
3144 | } | 3175 | } |
@@ -3149,7 +3180,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3149 | { | 3180 | { |
3150 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) | 3181 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) |
3151 | { | 3182 | { |
3152 | m_primFullUpdateTimer.Stop(); | 3183 | lock (m_primFullUpdateTimer) |
3184 | m_primFullUpdateTimer.Stop(); | ||
3153 | 3185 | ||
3154 | return; | 3186 | return; |
3155 | } | 3187 | } |
@@ -3196,7 +3228,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3196 | OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); | 3228 | OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); |
3197 | 3229 | ||
3198 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) | 3230 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) |
3199 | m_primFullUpdateTimer.Stop(); | 3231 | lock (m_primFullUpdateTimer) |
3232 | m_primFullUpdateTimer.Stop(); | ||
3200 | } | 3233 | } |
3201 | } | 3234 | } |
3202 | 3235 | ||
@@ -3234,7 +3267,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3234 | { | 3267 | { |
3235 | if (m_primTerseUpdates.Count == 0) | 3268 | if (m_primTerseUpdates.Count == 0) |
3236 | { | 3269 | { |
3237 | m_primTerseUpdateTimer.Stop(); | 3270 | lock (m_primTerseUpdateTimer) |
3271 | m_primTerseUpdateTimer.Stop(); | ||
3238 | 3272 | ||
3239 | return; | 3273 | return; |
3240 | } | 3274 | } |
@@ -3284,7 +3318,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3284 | OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); | 3318 | OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); |
3285 | 3319 | ||
3286 | if (m_primTerseUpdates.Count == 0) | 3320 | if (m_primTerseUpdates.Count == 0) |
3287 | m_primTerseUpdateTimer.Stop(); | 3321 | lock (m_primTerseUpdateTimer) |
3322 | m_primTerseUpdateTimer.Stop(); | ||
3288 | } | 3323 | } |
3289 | } | 3324 | } |
3290 | 3325 | ||
@@ -6586,7 +6621,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6586 | if (m_imageManager != null) | 6621 | if (m_imageManager != null) |
6587 | { | 6622 | { |
6588 | m_imageManager.EnqueueReq(args); | 6623 | m_imageManager.EnqueueReq(args); |
6589 | m_textureRequestTimer.Start(); | 6624 | lock (m_textureRequestTimer) |
6625 | m_textureRequestTimer.Start(); | ||
6590 | } | 6626 | } |
6591 | } | 6627 | } |
6592 | } | 6628 | } |
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 53b8ebc..49b459a 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -160,7 +160,10 @@ namespace Flotsam.RegionModules.AssetCache | |||
160 | m_CachCleanTimer.AutoReset = true; | 160 | m_CachCleanTimer.AutoReset = true; |
161 | m_CachCleanTimer.Elapsed += CleanupExpiredFiles; | 161 | m_CachCleanTimer.Elapsed += CleanupExpiredFiles; |
162 | m_CachCleanTimer.Enabled = true; | 162 | m_CachCleanTimer.Enabled = true; |
163 | m_CachCleanTimer.Start(); | 163 | lock (m_CachCleanTimer) |
164 | { | ||
165 | m_CachCleanTimer.Start(); | ||
166 | } | ||
164 | } | 167 | } |
165 | else | 168 | else |
166 | { | 169 | { |
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index f8208ec..7ac1e7e 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -78,7 +78,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
78 | bool permissionToDelete) | 78 | bool permissionToDelete) |
79 | { | 79 | { |
80 | if (Enabled) | 80 | if (Enabled) |
81 | m_inventoryTicker.Stop(); | 81 | lock (m_inventoryTicker) |
82 | m_inventoryTicker.Stop(); | ||
82 | 83 | ||
83 | lock (m_inventoryDeletes) | 84 | lock (m_inventoryDeletes) |
84 | { | 85 | { |
@@ -93,7 +94,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
93 | } | 94 | } |
94 | 95 | ||
95 | if (Enabled) | 96 | if (Enabled) |
96 | m_inventoryTicker.Start(); | 97 | lock (m_inventoryTicker) |
98 | m_inventoryTicker.Start(); | ||
97 | 99 | ||
98 | // Visually remove it, even if it isnt really gone yet. This means that if we crash before the object | 100 | // Visually remove it, even if it isnt really gone yet. This means that if we crash before the object |
99 | // has gone to inventory, it will reappear in the region again on restart instead of being lost. | 101 | // has gone to inventory, it will reappear in the region again on restart instead of being lost. |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 40e7471..b0d279c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3762,6 +3762,8 @@ if (m_shape != null) { | |||
3762 | lPos = AbsolutePosition; | 3762 | lPos = AbsolutePosition; |
3763 | } | 3763 | } |
3764 | 3764 | ||
3765 | // Causes this thread to dig into the Client Thread Data. | ||
3766 | // Remember your locking here! | ||
3765 | remoteClient.SendPrimTerseUpdate(m_regionHandle, | 3767 | remoteClient.SendPrimTerseUpdate(m_regionHandle, |
3766 | (ushort)(m_parentGroup.GetTimeDilation() * | 3768 | (ushort)(m_parentGroup.GetTimeDilation() * |
3767 | (float)ushort.MaxValue), LocalId, lPos, | 3769 | (float)ushort.MaxValue), LocalId, lPos, |