diff options
Diffstat (limited to '')
20 files changed, 197 insertions, 208 deletions
diff --git a/OpenSim/Framework/Monitoring/JobEngine.cs b/OpenSim/Framework/Monitoring/JobEngine.cs index 0a39e4b..a6a059d 100644 --- a/OpenSim/Framework/Monitoring/JobEngine.cs +++ b/OpenSim/Framework/Monitoring/JobEngine.cs | |||
@@ -136,12 +136,15 @@ namespace OpenSim.Framework.Monitoring | |||
136 | if(m_jobQueue.Count <= 0) | 136 | if(m_jobQueue.Count <= 0) |
137 | m_cancelSource.Cancel(); | 137 | m_cancelSource.Cancel(); |
138 | 138 | ||
139 | if(m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop)) | 139 | m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop); |
140 | m_finishedProcessingAfterStop.Close(); | 140 | m_finishedProcessingAfterStop.Close(); |
141 | } | 141 | } |
142 | finally | 142 | finally |
143 | { | 143 | { |
144 | m_cancelSource.Dispose(); | 144 | if(m_cancelSource != null) |
145 | m_cancelSource.Dispose(); | ||
146 | if(m_finishedProcessingAfterStop != null) | ||
147 | m_finishedProcessingAfterStop.Dispose(); | ||
145 | } | 148 | } |
146 | } | 149 | } |
147 | } | 150 | } |
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 8a4894e..5fb725c 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs | |||
@@ -193,7 +193,7 @@ namespace OpenSim.Framework.Monitoring | |||
193 | m_watchdogTimer.Dispose(); | 193 | m_watchdogTimer.Dispose(); |
194 | m_watchdogTimer = null; | 194 | m_watchdogTimer = null; |
195 | } | 195 | } |
196 | 196 | ||
197 | foreach(ThreadWatchdogInfo twi in m_threads.Values) | 197 | foreach(ThreadWatchdogInfo twi in m_threads.Values) |
198 | { | 198 | { |
199 | Thread t = twi.Thread; | 199 | Thread t = twi.Thread; |
@@ -341,6 +341,8 @@ namespace OpenSim.Framework.Monitoring | |||
341 | /// <param name="e"></param> | 341 | /// <param name="e"></param> |
342 | private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) | 342 | private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) |
343 | { | 343 | { |
344 | if(!m_enabled) | ||
345 | return; | ||
344 | int now = Environment.TickCount & Int32.MaxValue; | 346 | int now = Environment.TickCount & Int32.MaxValue; |
345 | int msElapsed = now - LastWatchdogThreadTick; | 347 | int msElapsed = now - LastWatchdogThreadTick; |
346 | 348 | ||
@@ -358,21 +360,26 @@ namespace OpenSim.Framework.Monitoring | |||
358 | List<ThreadWatchdogInfo> callbackInfos = null; | 360 | List<ThreadWatchdogInfo> callbackInfos = null; |
359 | List<ThreadWatchdogInfo> threadsToRemove = null; | 361 | List<ThreadWatchdogInfo> threadsToRemove = null; |
360 | 362 | ||
363 | const ThreadState thgone = ThreadState.Stopped | ThreadState.Aborted | ThreadState.AbortRequested; | ||
364 | |||
361 | lock (m_threads) | 365 | lock (m_threads) |
362 | { | 366 | { |
363 | foreach(ThreadWatchdogInfo threadInfo in m_threads.Values) | 367 | foreach(ThreadWatchdogInfo threadInfo in m_threads.Values) |
364 | { | 368 | { |
365 | if(threadInfo.Thread.ThreadState == ThreadState.Stopped) | 369 | if(!m_enabled) |
370 | return; | ||
371 | if(!threadInfo.Thread.IsAlive || (threadInfo.Thread.ThreadState & thgone) != 0) | ||
366 | { | 372 | { |
367 | if(threadsToRemove == null) | 373 | if(threadsToRemove == null) |
368 | threadsToRemove = new List<ThreadWatchdogInfo>(); | 374 | threadsToRemove = new List<ThreadWatchdogInfo>(); |
369 | 375 | ||
370 | threadsToRemove.Add(threadInfo); | 376 | threadsToRemove.Add(threadInfo); |
371 | 377 | /* | |
372 | if(callbackInfos == null) | 378 | if(callbackInfos == null) |
373 | callbackInfos = new List<ThreadWatchdogInfo>(); | 379 | callbackInfos = new List<ThreadWatchdogInfo>(); |
374 | 380 | ||
375 | callbackInfos.Add(threadInfo); | 381 | callbackInfos.Add(threadInfo); |
382 | */ | ||
376 | } | 383 | } |
377 | else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) | 384 | else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) |
378 | { | 385 | { |
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 7de8c52..75ed999 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -420,6 +420,7 @@ namespace OpenSim.Framework | |||
420 | set { m_remotingPort = value; } | 420 | set { m_remotingPort = value; } |
421 | } | 421 | } |
422 | 422 | ||
423 | |||
423 | /// <value> | 424 | /// <value> |
424 | /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. | 425 | /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. |
425 | /// | 426 | /// |
@@ -427,42 +428,7 @@ namespace OpenSim.Framework | |||
427 | /// </value> | 428 | /// </value> |
428 | public IPEndPoint ExternalEndPoint | 429 | public IPEndPoint ExternalEndPoint |
429 | { | 430 | { |
430 | get | 431 | get { return Util.getEndPoint(m_externalHostName, m_internalEndPoint.Port); } |
431 | { | ||
432 | // Old one defaults to IPv6 | ||
433 | //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); | ||
434 | |||
435 | IPAddress ia = null; | ||
436 | // If it is already an IP, don't resolve it - just return directly | ||
437 | if (IPAddress.TryParse(m_externalHostName, out ia)) | ||
438 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
439 | |||
440 | // Reset for next check | ||
441 | ia = null; | ||
442 | try | ||
443 | { | ||
444 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) | ||
445 | { | ||
446 | if (ia == null) | ||
447 | ia = Adr; | ||
448 | |||
449 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
450 | { | ||
451 | ia = Adr; | ||
452 | break; | ||
453 | } | ||
454 | } | ||
455 | } | ||
456 | catch (SocketException e) | ||
457 | { | ||
458 | throw new Exception( | ||
459 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | ||
460 | e + "' attached to this exception", e); | ||
461 | } | ||
462 | |||
463 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
464 | } | ||
465 | |||
466 | set { m_externalHostName = value.ToString(); } | 432 | set { m_externalHostName = value.ToString(); } |
467 | } | 433 | } |
468 | 434 | ||
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 5eedd29..83d9df1 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -429,6 +429,65 @@ namespace OpenSim.Framework | |||
429 | return regionCoord << 8; | 429 | return regionCoord << 8; |
430 | } | 430 | } |
431 | 431 | ||
432 | public static IPEndPoint getEndPoint(IPAddress ia, int port) | ||
433 | { | ||
434 | if(ia == null) | ||
435 | return null; | ||
436 | |||
437 | IPEndPoint newEP = null; | ||
438 | try | ||
439 | { | ||
440 | newEP = new IPEndPoint(ia, port); | ||
441 | } | ||
442 | catch | ||
443 | { | ||
444 | newEP = null; | ||
445 | } | ||
446 | return newEP; | ||
447 | } | ||
448 | |||
449 | public static IPEndPoint getEndPoint(string hostname, int port) | ||
450 | { | ||
451 | IPAddress ia = null; | ||
452 | // If it is already an IP, don't resolve it - just return directly | ||
453 | // we should not need this | ||
454 | if (IPAddress.TryParse(hostname, out ia)) | ||
455 | { | ||
456 | if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) | ||
457 | return null; | ||
458 | return getEndPoint(ia, port); | ||
459 | } | ||
460 | |||
461 | // Reset for next check | ||
462 | ia = null; | ||
463 | try | ||
464 | { | ||
465 | foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) | ||
466 | { | ||
467 | if (ia == null) | ||
468 | ia = Adr; | ||
469 | |||
470 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
471 | { | ||
472 | ia = Adr; | ||
473 | break; | ||
474 | } | ||
475 | } | ||
476 | } | ||
477 | catch // (SocketException e) | ||
478 | { | ||
479 | /*throw new Exception( | ||
480 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | ||
481 | e + "' attached to this exception", e);*/ | ||
482 | // Don't throw a fatal exception here, instead, return Null and handle it in the caller. | ||
483 | // Reason is, on systems such as OSgrid it has occured that known hostnames stop | ||
484 | // resolving and thus make surrounding regions crash out with this exception. | ||
485 | return null; | ||
486 | } | ||
487 | |||
488 | return getEndPoint(ia,port); | ||
489 | } | ||
490 | |||
432 | public static bool checkServiceURI(string uristr, out string serviceURI) | 491 | public static bool checkServiceURI(string uristr, out string serviceURI) |
433 | { | 492 | { |
434 | serviceURI = string.Empty; | 493 | serviceURI = string.Empty; |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 5977f40..fcc8717 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -511,8 +511,6 @@ namespace OpenSim | |||
511 | private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi) | 511 | private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi) |
512 | { | 512 | { |
513 | int now = Environment.TickCount & Int32.MaxValue; | 513 | int now = Environment.TickCount & Int32.MaxValue; |
514 | if(twi.Thread.ThreadState == System.Threading.ThreadState.Stopped) | ||
515 | return; | ||
516 | m_log.ErrorFormat( | 514 | m_log.ErrorFormat( |
517 | "[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}", | 515 | "[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}", |
518 | twi.Thread.Name, | 516 | twi.Thread.Name, |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 27db72c..414b9bf 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | |||
@@ -203,10 +203,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
203 | { | 203 | { |
204 | while(true) | 204 | while(true) |
205 | { | 205 | { |
206 | aPollRequest poolreq = m_queue.Dequeue(1000); | 206 | aPollRequest poolreq = m_queue.Dequeue(4500); |
207 | Watchdog.UpdateThread(); | ||
207 | if(m_NumberScenes <= 0) | 208 | if(m_NumberScenes <= 0) |
208 | return; | 209 | return; |
209 | Watchdog.UpdateThread(); | ||
210 | if(poolreq.reqID != UUID.Zero) | 210 | if(poolreq.reqID != UUID.Zero) |
211 | poolreq.thepoll.Process(poolreq); | 211 | poolreq.thepoll.Process(poolreq); |
212 | } | 212 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index d6b4873..1a31157 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -445,10 +445,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
445 | { | 445 | { |
446 | while (true) | 446 | while (true) |
447 | { | 447 | { |
448 | aPollRequest poolreq = m_queue.Dequeue(2000); | 448 | aPollRequest poolreq = m_queue.Dequeue(4500); |
449 | Watchdog.UpdateThread(); | ||
449 | if(m_NumberScenes <= 0) | 450 | if(m_NumberScenes <= 0) |
450 | return; | 451 | return; |
451 | Watchdog.UpdateThread(); | ||
452 | if(poolreq.reqID != UUID.Zero) | 452 | if(poolreq.reqID != UUID.Zero) |
453 | poolreq.thepoll.Process(poolreq); | 453 | poolreq.thepoll.Process(poolreq); |
454 | } | 454 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 422c354..5011c44 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |||
@@ -479,10 +479,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
479 | { | 479 | { |
480 | while (true) | 480 | while (true) |
481 | { | 481 | { |
482 | aPollRequest poolreq = m_queue.Dequeue(4500); | ||
482 | Watchdog.UpdateThread(); | 483 | Watchdog.UpdateThread(); |
483 | 484 | ||
484 | aPollRequest poolreq = m_queue.Dequeue(5000); | ||
485 | |||
486 | if (poolreq != null && poolreq.thepoll != null) | 485 | if (poolreq != null && poolreq.thepoll != null) |
487 | { | 486 | { |
488 | try | 487 | try |
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 610e279..e5ac17d 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -646,7 +646,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
646 | if (m_LogLevel >= 2) | 646 | if (m_LogLevel >= 2) |
647 | m_log.Debug("[FLOTSAM ASSET CACHE]: Clearing caches."); | 647 | m_log.Debug("[FLOTSAM ASSET CACHE]: Clearing caches."); |
648 | 648 | ||
649 | if (m_FileCacheEnabled) | 649 | if (m_FileCacheEnabled && Directory.Exists(m_CacheDirectory)) |
650 | { | 650 | { |
651 | foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) | 651 | foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) |
652 | { | 652 | { |
@@ -681,10 +681,10 @@ namespace OpenSim.Region.CoreModules.Asset | |||
681 | // before cleaning up expired files we must scan the objects in the scene to make sure that we retain | 681 | // before cleaning up expired files we must scan the objects in the scene to make sure that we retain |
682 | // such local assets if they have not been recently accessed. | 682 | // such local assets if they have not been recently accessed. |
683 | TouchAllSceneAssets(false); | 683 | TouchAllSceneAssets(false); |
684 | 684 | if(Directory.Exists(m_CacheDirectory)) | |
685 | foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) | ||
686 | { | 685 | { |
687 | CleanExpiredFiles(dir, purgeLine); | 686 | foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) |
687 | CleanExpiredFiles(dir, purgeLine); | ||
688 | } | 688 | } |
689 | 689 | ||
690 | lock(timerLock) | 690 | lock(timerLock) |
@@ -706,6 +706,9 @@ namespace OpenSim.Region.CoreModules.Asset | |||
706 | { | 706 | { |
707 | try | 707 | try |
708 | { | 708 | { |
709 | if(!Directory.Exists(dir)) | ||
710 | return; | ||
711 | |||
709 | foreach (string file in Directory.GetFiles(dir)) | 712 | foreach (string file in Directory.GetFiles(dir)) |
710 | { | 713 | { |
711 | if (File.GetLastAccessTime(file) < purgeLine) | 714 | if (File.GetLastAccessTime(file) < purgeLine) |
@@ -869,6 +872,9 @@ namespace OpenSim.Region.CoreModules.Asset | |||
869 | /// <returns></returns> | 872 | /// <returns></returns> |
870 | private int GetFileCacheCount(string dir) | 873 | private int GetFileCacheCount(string dir) |
871 | { | 874 | { |
875 | if(!Directory.Exists(dir)) | ||
876 | return 0; | ||
877 | |||
872 | int count = Directory.GetFiles(dir).Length; | 878 | int count = Directory.GetFiles(dir).Length; |
873 | 879 | ||
874 | foreach (string subdir in Directory.GetDirectories(dir)) | 880 | foreach (string subdir in Directory.GetDirectories(dir)) |
@@ -987,6 +993,9 @@ namespace OpenSim.Region.CoreModules.Asset | |||
987 | /// </summary> | 993 | /// </summary> |
988 | private void ClearFileCache() | 994 | private void ClearFileCache() |
989 | { | 995 | { |
996 | if(!Directory.Exists(m_CacheDirectory)) | ||
997 | return; | ||
998 | |||
990 | foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) | 999 | foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) |
991 | { | 1000 | { |
992 | try | 1001 | try |
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index aed1372..f68c5f8 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs | |||
@@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | |||
658 | public void Process() | 658 | public void Process() |
659 | { | 659 | { |
660 | _finished = false; | 660 | _finished = false; |
661 | httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false); | 661 | httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false, null, int.MaxValue); |
662 | } | 662 | } |
663 | 663 | ||
664 | /* | 664 | /* |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs index 84e52f7..f6fff58 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs | |||
@@ -385,7 +385,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
385 | storage[handle] = region; | 385 | storage[handle] = region; |
386 | byname[region.RegionName] = handle; | 386 | byname[region.RegionName] = handle; |
387 | byuuid[region.RegionID] = handle; | 387 | byuuid[region.RegionID] = handle; |
388 | |||
389 | } | 388 | } |
390 | 389 | ||
391 | public void Remove(GridRegion region) | 390 | public void Remove(GridRegion region) |
@@ -400,7 +399,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
400 | 399 | ||
401 | ulong handle = region.RegionHandle & HANDLEMASK; | 400 | ulong handle = region.RegionHandle & HANDLEMASK; |
402 | if(storage != null) | 401 | if(storage != null) |
403 | storage.Remove(handle); | 402 | { |
403 | if(storage.ContainsKey(handle)) | ||
404 | { | ||
405 | storage[handle] = null; | ||
406 | storage.Remove(handle); | ||
407 | } | ||
408 | } | ||
404 | removeFromInner(region); | 409 | removeFromInner(region); |
405 | if(expires != null) | 410 | if(expires != null) |
406 | { | 411 | { |
@@ -424,6 +429,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
424 | if(byuuid != null) | 429 | if(byuuid != null) |
425 | byuuid.Remove(r.RegionID); | 430 | byuuid.Remove(r.RegionID); |
426 | removeFromInner(r); | 431 | removeFromInner(r); |
432 | storage[handle] = null; | ||
427 | } | 433 | } |
428 | storage.Remove(handle); | 434 | storage.Remove(handle); |
429 | } | 435 | } |
@@ -581,27 +587,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
581 | { | 587 | { |
582 | if(expires == null || expires.Count == 0) | 588 | if(expires == null || expires.Count == 0) |
583 | return 0; | 589 | return 0; |
584 | 590 | ||
591 | int expiresCount = expires.Count; | ||
585 | List<ulong> toexpire = new List<ulong>(); | 592 | List<ulong> toexpire = new List<ulong>(); |
593 | |||
586 | foreach(KeyValuePair<ulong, DateTime> kvp in expires) | 594 | foreach(KeyValuePair<ulong, DateTime> kvp in expires) |
587 | { | 595 | { |
588 | if(kvp.Value < now) | 596 | if(kvp.Value < now) |
589 | toexpire.Add(kvp.Key); | 597 | toexpire.Add(kvp.Key); |
590 | } | 598 | } |
591 | 599 | ||
592 | if(toexpire.Count == 0) | 600 | int toexpireCount = toexpire.Count; |
593 | return expires.Count; | 601 | if(toexpireCount == 0) |
602 | return expiresCount; | ||
594 | 603 | ||
595 | if(toexpire.Count == expires.Count) | 604 | if(toexpireCount == expiresCount) |
596 | { | 605 | { |
597 | Clear(); | 606 | Clear(); |
598 | return 0; | 607 | return 0; |
599 | } | 608 | } |
600 | 609 | ||
601 | foreach(ulong h in toexpire) | 610 | if(storage != null) |
602 | { | 611 | { |
603 | if(storage != null) | 612 | ulong h; |
613 | for(int i = 0; i < toexpireCount; i++) | ||
604 | { | 614 | { |
615 | h = toexpire[i]; | ||
605 | if(storage.ContainsKey(h)) | 616 | if(storage.ContainsKey(h)) |
606 | { | 617 | { |
607 | GridRegion r = storage[h]; | 618 | GridRegion r = storage[h]; |
@@ -610,14 +621,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
610 | if(byuuid != null) | 621 | if(byuuid != null) |
611 | byuuid.Remove(r.RegionID); | 622 | byuuid.Remove(r.RegionID); |
612 | removeFromInner(r); | 623 | removeFromInner(r); |
624 | |||
625 | storage[h] = null; | ||
626 | storage.Remove(h); | ||
613 | } | 627 | } |
614 | storage.Remove(h); | 628 | if(expires != null) |
629 | expires.Remove(h); | ||
615 | } | 630 | } |
616 | if(expires != null) | 631 | } |
617 | expires.Remove(h); | 632 | else |
633 | { | ||
634 | Clear(); | ||
635 | return 0; | ||
618 | } | 636 | } |
619 | 637 | ||
620 | if(expires.Count == 0) | 638 | expiresCount = expires.Count; |
639 | if(expiresCount == 0) | ||
621 | { | 640 | { |
622 | byname = null; | 641 | byname = null; |
623 | byuuid = null; | 642 | byuuid = null; |
@@ -626,7 +645,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
626 | return 0; | 645 | return 0; |
627 | } | 646 | } |
628 | 647 | ||
629 | return expires.Count; | 648 | return expiresCount; |
630 | } | 649 | } |
631 | 650 | ||
632 | public int Count() | 651 | public int Count() |
@@ -693,7 +712,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
693 | 712 | ||
694 | public class RegionsExpiringCache | 713 | public class RegionsExpiringCache |
695 | { | 714 | { |
696 | const double CACHE_PURGE_HZ = 60; // seconds | 715 | const double CACHE_PURGE_TIME = 60000; // milliseconds |
697 | const int MAX_LOCK_WAIT = 10000; // milliseconds | 716 | const int MAX_LOCK_WAIT = 10000; // milliseconds |
698 | 717 | ||
699 | /// <summary>For thread safety</summary> | 718 | /// <summary>For thread safety</summary> |
@@ -702,7 +721,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
702 | object isPurging = new object(); | 721 | object isPurging = new object(); |
703 | 722 | ||
704 | Dictionary<UUID, RegionInfoForScope> InfobyScope = new Dictionary<UUID, RegionInfoForScope>(); | 723 | Dictionary<UUID, RegionInfoForScope> InfobyScope = new Dictionary<UUID, RegionInfoForScope>(); |
705 | private System.Timers.Timer timer = new System.Timers.Timer(TimeSpan.FromSeconds(CACHE_PURGE_HZ).TotalMilliseconds); | 724 | private System.Timers.Timer timer = new System.Timers.Timer(CACHE_PURGE_TIME); |
706 | 725 | ||
707 | public RegionsExpiringCache() | 726 | public RegionsExpiringCache() |
708 | { | 727 | { |
@@ -965,7 +984,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
965 | if (expiredscopes.Count > 0) | 984 | if (expiredscopes.Count > 0) |
966 | { | 985 | { |
967 | foreach (UUID sid in expiredscopes) | 986 | foreach (UUID sid in expiredscopes) |
987 | { | ||
988 | InfobyScope[sid] = null; | ||
968 | InfobyScope.Remove(sid); | 989 | InfobyScope.Remove(sid); |
990 | } | ||
969 | } | 991 | } |
970 | } | 992 | } |
971 | finally { Monitor.Exit(syncRoot); } | 993 | finally { Monitor.Exit(syncRoot); } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 00c8279..03a4d34 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -716,12 +716,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
716 | { | 716 | { |
717 | while (true) | 717 | while (true) |
718 | { | 718 | { |
719 | Watchdog.UpdateThread(); | ||
720 | |||
721 | av = null; | 719 | av = null; |
722 | st = null; | 720 | st = null; |
723 | 721 | ||
724 | st = requests.Dequeue(4900); // timeout to make watchdog happy | 722 | st = requests.Dequeue(4500); |
723 | Watchdog.UpdateThread(); | ||
725 | 724 | ||
726 | if (st == null || st.agentID == UUID.Zero) | 725 | if (st == null || st.agentID == UUID.Zero) |
727 | continue; | 726 | continue; |
@@ -1152,10 +1151,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1152 | { | 1151 | { |
1153 | while(!m_mapBlockRequestEvent.WaitOne(4900)) | 1152 | while(!m_mapBlockRequestEvent.WaitOne(4900)) |
1154 | { | 1153 | { |
1154 | Watchdog.UpdateThread(); | ||
1155 | if(m_scene == null) | 1155 | if(m_scene == null) |
1156 | return; | 1156 | return; |
1157 | } | 1157 | } |
1158 | 1158 | Watchdog.UpdateThread(); | |
1159 | lock (m_mapBlockRequestEvent) | 1159 | lock (m_mapBlockRequestEvent) |
1160 | { | 1160 | { |
1161 | int total = 0; | 1161 | int total = 0; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 1688aa6..e01d2e4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs | |||
@@ -226,9 +226,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
226 | try | 226 | try |
227 | { | 227 | { |
228 | Thread.Sleep(cmdHandlerThreadCycleSleepms); | 228 | Thread.Sleep(cmdHandlerThreadCycleSleepms); |
229 | 229 | Watchdog.UpdateThread(); | |
230 | DoOneCmdHandlerPass(); | 230 | DoOneCmdHandlerPass(); |
231 | |||
232 | Watchdog.UpdateThread(); | 231 | Watchdog.UpdateThread(); |
233 | } | 232 | } |
234 | catch ( System.Threading.ThreadAbortException) { } | 233 | catch ( System.Threading.ThreadAbortException) { } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index f3b8e1d..20f9770 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -79,12 +79,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
79 | 79 | ||
80 | private List<string> m_warnings = new List<string>(); | 80 | private List<string> m_warnings = new List<string>(); |
81 | 81 | ||
82 | // private object m_syncy = new object(); | ||
83 | |||
84 | // private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); | ||
85 | // private static VBCodeProvider VBcodeProvider = new VBCodeProvider(); | ||
86 | |||
87 | // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files | ||
88 | private static UInt64 scriptCompileCounter = 0; // And a counter | 82 | private static UInt64 scriptCompileCounter = 0; // And a counter |
89 | 83 | ||
90 | public IScriptEngine m_scriptEngine; | 84 | public IScriptEngine m_scriptEngine; |
@@ -251,23 +245,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
251 | } | 245 | } |
252 | } | 246 | } |
253 | 247 | ||
254 | ////private ICodeCompiler icc = codeProvider.CreateCompiler(); | ||
255 | //public string CompileFromFile(string LSOFileName) | ||
256 | //{ | ||
257 | // switch (Path.GetExtension(LSOFileName).ToLower()) | ||
258 | // { | ||
259 | // case ".txt": | ||
260 | // case ".lsl": | ||
261 | // Common.ScriptEngineBase.Shared.SendToDebug("Source code is LSL, converting to CS"); | ||
262 | // return CompileFromLSLText(File.ReadAllText(LSOFileName)); | ||
263 | // case ".cs": | ||
264 | // Common.ScriptEngineBase.Shared.SendToDebug("Source code is CS"); | ||
265 | // return CompileFromCSText(File.ReadAllText(LSOFileName)); | ||
266 | // default: | ||
267 | // throw new Exception("Unknown script type."); | ||
268 | // } | ||
269 | //} | ||
270 | |||
271 | public string GetCompilerOutput(string assetID) | 248 | public string GetCompilerOutput(string assetID) |
272 | { | 249 | { |
273 | return Path.Combine(ScriptEnginesPath, Path.Combine( | 250 | return Path.Combine(ScriptEnginesPath, Path.Combine( |
@@ -578,8 +555,6 @@ namespace SecondLife | |||
578 | switch (lang) | 555 | switch (lang) |
579 | { | 556 | { |
580 | case enumCompileType.vb: | 557 | case enumCompileType.vb: |
581 | // results = VBcodeProvider.CompileAssemblyFromSource( | ||
582 | // parameters, Script); | ||
583 | provider = CodeDomProvider.CreateProvider("VisualBasic"); | 558 | provider = CodeDomProvider.CreateProvider("VisualBasic"); |
584 | break; | 559 | break; |
585 | case enumCompileType.cs: | 560 | case enumCompileType.cs: |
@@ -594,56 +569,36 @@ namespace SecondLife | |||
594 | if(provider == null) | 569 | if(provider == null) |
595 | throw new Exception("Compiler failed to load "); | 570 | throw new Exception("Compiler failed to load "); |
596 | 571 | ||
572 | bool complete = false; | ||
573 | bool retried = false; | ||
597 | 574 | ||
598 | bool complete = false; | 575 | do |
599 | bool retried = false; | 576 | { |
600 | 577 | results = provider.CompileAssemblyFromSource( | |
601 | do | 578 | parameters, Script); |
579 | // Deal with an occasional segv in the compiler. | ||
580 | // Rarely, if ever, occurs twice in succession. | ||
581 | // Line # == 0 and no file name are indications that | ||
582 | // this is a native stack trace rather than a normal | ||
583 | // error log. | ||
584 | if (results.Errors.Count > 0) | ||
585 | { | ||
586 | if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) && | ||
587 | results.Errors[0].Line == 0) | ||
602 | { | 588 | { |
603 | // lock (CScodeProvider) | 589 | // System.Console.WriteLine("retrying failed compilation"); |
604 | // { | 590 | retried = true; |
605 | // results = CScodeProvider.CompileAssemblyFromSource( | 591 | } |
606 | // parameters, Script); | 592 | else |
607 | // } | 593 | { |
608 | 594 | complete = true; | |
609 | results = provider.CompileAssemblyFromSource( | 595 | } |
610 | parameters, Script); | 596 | } |
611 | // Deal with an occasional segv in the compiler. | 597 | else |
612 | // Rarely, if ever, occurs twice in succession. | 598 | { |
613 | // Line # == 0 and no file name are indications that | 599 | complete = true; |
614 | // this is a native stack trace rather than a normal | 600 | } |
615 | // error log. | 601 | } while (!complete); |
616 | if (results.Errors.Count > 0) | ||
617 | { | ||
618 | if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) && | ||
619 | results.Errors[0].Line == 0) | ||
620 | { | ||
621 | // System.Console.WriteLine("retrying failed compilation"); | ||
622 | retried = true; | ||
623 | } | ||
624 | else | ||
625 | { | ||
626 | complete = true; | ||
627 | } | ||
628 | } | ||
629 | else | ||
630 | { | ||
631 | complete = true; | ||
632 | } | ||
633 | } while (!complete); | ||
634 | // break; | ||
635 | // default: | ||
636 | // throw new Exception("Compiler is not able to recongnize " + | ||
637 | // "language type \"" + lang.ToString() + "\""); | ||
638 | // } | ||
639 | |||
640 | // foreach (Type type in results.CompiledAssembly.GetTypes()) | ||
641 | // { | ||
642 | // foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static)) | ||
643 | // { | ||
644 | // m_log.DebugFormat("[COMPILER]: {0}.{1}", type.FullName, method.Name); | ||
645 | // } | ||
646 | // } | ||
647 | 602 | ||
648 | // | 603 | // |
649 | // WARNINGS AND ERRORS | 604 | // WARNINGS AND ERRORS |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index c1abba2..870957b 100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -2149,10 +2149,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
2149 | string fn = Path.GetFileName(assemName); | 2149 | string fn = Path.GetFileName(assemName); |
2150 | 2150 | ||
2151 | string assem = String.Empty; | 2151 | string assem = String.Empty; |
2152 | string assemNameText = assemName + ".text"; | ||
2152 | 2153 | ||
2153 | if (File.Exists(assemName + ".text")) | 2154 | if (File.Exists(assemNameText)) |
2154 | { | 2155 | { |
2155 | FileInfo tfi = new FileInfo(assemName + ".text"); | 2156 | FileInfo tfi = new FileInfo(assemNameText); |
2156 | 2157 | ||
2157 | if (tfi != null) | 2158 | if (tfi != null) |
2158 | { | 2159 | { |
@@ -2160,7 +2161,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
2160 | 2161 | ||
2161 | try | 2162 | try |
2162 | { | 2163 | { |
2163 | using (FileStream tfs = File.Open(assemName + ".text", | 2164 | using (FileStream tfs = File.Open(assemNameText, |
2164 | FileMode.Open, FileAccess.Read)) | 2165 | FileMode.Open, FileAccess.Read)) |
2165 | { | 2166 | { |
2166 | tfs.Read(tdata, 0, tdata.Length); | 2167 | tfs.Read(tdata, 0, tdata.Length); |
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index b17d7ba..aff6b4f 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -478,17 +478,22 @@ namespace OpenSim.Server.Base | |||
478 | 478 | ||
479 | XmlDocument doc = new XmlDocument(); | 479 | XmlDocument doc = new XmlDocument(); |
480 | 480 | ||
481 | doc.LoadXml(data); | 481 | try |
482 | 482 | { | |
483 | XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse"); | 483 | doc.LoadXml(data); |
484 | 484 | XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse"); | |
485 | if (rootL.Count != 1) | ||
486 | return ret; | ||
487 | 485 | ||
488 | XmlNode rootNode = rootL[0]; | 486 | if (rootL.Count != 1) |
487 | return ret; | ||
489 | 488 | ||
490 | ret = ParseElement(rootNode); | 489 | XmlNode rootNode = rootL[0]; |
491 | 490 | ||
491 | ret = ParseElement(rootNode); | ||
492 | } | ||
493 | catch (Exception e) | ||
494 | { | ||
495 | m_log.DebugFormat("[serverUtils.ParseXmlResponse]: failed error: {0} \n --- string: {1} - ",e.Message, data); | ||
496 | } | ||
492 | return ret; | 497 | return ret; |
493 | } | 498 | } |
494 | 499 | ||
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 2deb2d1..7e81be7 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -34,7 +34,7 @@ using System.Reflection; | |||
34 | using System.Timers; | 34 | using System.Timers; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Monitoring; |
38 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
39 | using OpenMetaverse; | 39 | using OpenMetaverse; |
40 | 40 | ||
@@ -135,7 +135,11 @@ namespace OpenSim.Services.Connectors | |||
135 | 135 | ||
136 | for (int i = 0 ; i < 2 ; i++) | 136 | for (int i = 0 ; i < 2 ; i++) |
137 | { | 137 | { |
138 | Util.FireAndForget(delegate { AssetRequestProcessor();}); | 138 | m_fetchThreads[i] = WorkManager.StartThread(AssetRequestProcessor, |
139 | String.Format("GetTextureWorker{0}", i), | ||
140 | ThreadPriority.Normal, | ||
141 | true, | ||
142 | false); | ||
139 | } | 143 | } |
140 | } | 144 | } |
141 | 145 | ||
@@ -357,7 +361,8 @@ namespace OpenSim.Services.Connectors | |||
357 | 361 | ||
358 | while (true) | 362 | while (true) |
359 | { | 363 | { |
360 | r = m_requestQueue.Dequeue(2000); | 364 | r = m_requestQueue.Dequeue(4500); |
365 | Watchdog.UpdateThread(); | ||
361 | if(r== null) | 366 | if(r== null) |
362 | continue; | 367 | continue; |
363 | string uri = r.uri; | 368 | string uri = r.uri; |
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 8068ff5..ead5d3c 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -462,50 +462,7 @@ namespace OpenSim.Services.Interfaces | |||
462 | /// </value> | 462 | /// </value> |
463 | public IPEndPoint ExternalEndPoint | 463 | public IPEndPoint ExternalEndPoint |
464 | { | 464 | { |
465 | get | 465 | get { return Util.getEndPoint(m_externalHostName, m_internalEndPoint.Port); } |
466 | { | ||
467 | IPAddress ia = null; | ||
468 | // If it is already an IP, don't resolve it - just return directly | ||
469 | // we should not need this | ||
470 | if (IPAddress.TryParse(m_externalHostName, out ia)) | ||
471 | { | ||
472 | if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) | ||
473 | return null; | ||
474 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
475 | } | ||
476 | |||
477 | // Reset for next check | ||
478 | ia = null; | ||
479 | try | ||
480 | { | ||
481 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) | ||
482 | { | ||
483 | if (ia == null) | ||
484 | ia = Adr; | ||
485 | |||
486 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
487 | { | ||
488 | ia = Adr; | ||
489 | break; | ||
490 | } | ||
491 | } | ||
492 | } | ||
493 | catch // (SocketException e) | ||
494 | { | ||
495 | /*throw new Exception( | ||
496 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | ||
497 | e + "' attached to this exception", e);*/ | ||
498 | // Don't throw a fatal exception here, instead, return Null and handle it in the caller. | ||
499 | // Reason is, on systems such as OSgrid it has occured that known hostnames stop | ||
500 | // resolving and thus make surrounding regions crash out with this exception. | ||
501 | return null; | ||
502 | } | ||
503 | |||
504 | if(ia == null) | ||
505 | return null; | ||
506 | |||
507 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
508 | } | ||
509 | } | 466 | } |
510 | 467 | ||
511 | public string ExternalHostName | 468 | public string ExternalHostName |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 74888b3..3482270 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -256,6 +256,10 @@ | |||
256 | ;; alternative OpenDynamicsEngine engine. ubODEMeshmerizer meshing above MUST be selected also | 256 | ;; alternative OpenDynamicsEngine engine. ubODEMeshmerizer meshing above MUST be selected also |
257 | ; physics = ubODE | 257 | ; physics = ubODE |
258 | 258 | ||
259 | ; ubODE and OpenDynamicsEngine does allocate a lot of memory on stack. On linux you may need to increase its limit | ||
260 | ; script opensim-ode-sh starts opensim setting that limit. You may need to increase it even more on large regions | ||
261 | ; edit the line ulimit -s 262144, and change this last value | ||
262 | |||
259 | ;# {DefaultScriptEngine} {} {Default script engine} {XEngine} XEngine | 263 | ;# {DefaultScriptEngine} {} {Default script engine} {XEngine} XEngine |
260 | ;; Default script engine to use. Currently, we only have XEngine | 264 | ;; Default script engine to use. Currently, we only have XEngine |
261 | ; DefaultScriptEngine = "XEngine" | 265 | ; DefaultScriptEngine = "XEngine" |
diff --git a/bin/opensim-ode.sh b/bin/opensim-ode.sh index b901425..7c61571 100755 --- a/bin/opensim-ode.sh +++ b/bin/opensim-ode.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | echo "Starting OpenSimulator with ODE. If you get an error saying limit: Operation not permitted. Then you will need to chmod 0600 /etc/limits" | 2 | echo "Starting OpenSimulator with ODE or ubOde. If you get an error saying limit: Operation not permitted. Then you will need to chmod 0600 /etc/limits" |
3 | ulimit -s 262144 | 3 | ulimit -s 262144 |
4 | mono OpenSim.exe -physics=OpenDynamicsEngine | 4 | mono OpenSim.exe |