Merge branch 'master' into careminster
commit
37068d17c5
|
@ -247,7 +247,7 @@ namespace OpenSim.Framework.Servers
|
|||
string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}";
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads();
|
||||
Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreadsInfo();
|
||||
|
||||
sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine);
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
String.Format("PollServiceWorkerThread{0}", i),
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
int.MaxValue);
|
||||
}
|
||||
|
||||
|
@ -73,6 +74,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
"PollServiceWatcherThread",
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
1000 * 60 * 10);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,11 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
public bool IsTimedOut { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Will this thread trigger the alarm function if it has timed out?
|
||||
/// </summary>
|
||||
public bool AlarmIfTimeout { get; set; }
|
||||
|
||||
public ThreadWatchdogInfo(Thread thread, int timeout)
|
||||
{
|
||||
Thread = thread;
|
||||
|
@ -112,12 +117,13 @@ namespace OpenSim.Framework
|
|||
/// <param name="start">The method that will be executed in a new thread</param>
|
||||
/// <param name="name">A name to give to the new thread</param>
|
||||
/// <param name="priority">Priority to run the thread at</param>
|
||||
/// <param name="isBackground">True to run this thread as a background
|
||||
/// thread, otherwise false</param>
|
||||
/// <param name="isBackground">True to run this thread as a background thread, otherwise false</param>
|
||||
/// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
|
||||
/// <returns>The newly created Thread object</returns>
|
||||
public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground)
|
||||
public static Thread StartThread(
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout)
|
||||
{
|
||||
return StartThread(start, name, priority, isBackground, WATCHDOG_TIMEOUT_MS);
|
||||
return StartThread(start, name, priority, isBackground, alarmIfTimeout, WATCHDOG_TIMEOUT_MS);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -128,21 +134,21 @@ namespace OpenSim.Framework
|
|||
/// <param name="priority">Priority to run the thread at</param>
|
||||
/// <param name="isBackground">True to run this thread as a background
|
||||
/// thread, otherwise false</param>
|
||||
/// <param name="timeout">
|
||||
/// Number of milliseconds to wait until we issue a warning about timeout.
|
||||
/// </para>
|
||||
/// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
|
||||
/// <param name="timeout">Number of milliseconds to wait until we issue a warning about timeout.</param>
|
||||
/// <returns>The newly created Thread object</returns>
|
||||
public static Thread StartThread(
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, int timeout)
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout, int timeout)
|
||||
{
|
||||
Thread thread = new Thread(start);
|
||||
thread.Name = name;
|
||||
thread.Priority = priority;
|
||||
thread.IsBackground = isBackground;
|
||||
|
||||
ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout);
|
||||
ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout) { AlarmIfTimeout = alarmIfTimeout };
|
||||
|
||||
m_log.Debug("[WATCHDOG]: Started tracking thread \"" + twi.Thread.Name + "\" (ID " + twi.Thread.ManagedThreadId + ")");
|
||||
m_log.DebugFormat(
|
||||
"[WATCHDOG]: Started tracking thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
|
||||
|
||||
lock (m_threads)
|
||||
m_threads.Add(twi.Thread.ManagedThreadId, twi);
|
||||
|
@ -224,19 +230,39 @@ namespace OpenSim.Framework
|
|||
/// Get currently watched threads for diagnostic purposes
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ThreadWatchdogInfo[] GetThreads()
|
||||
public static ThreadWatchdogInfo[] GetThreadsInfo()
|
||||
{
|
||||
lock (m_threads)
|
||||
return m_threads.Values.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the current thread's watchdog info.
|
||||
/// </summary>
|
||||
/// <returns>The watchdog info. null if the thread isn't being monitored.</returns>
|
||||
public static ThreadWatchdogInfo GetCurrentThreadInfo()
|
||||
{
|
||||
lock (m_threads)
|
||||
{
|
||||
if (m_threads.ContainsKey(Thread.CurrentThread.ManagedThreadId))
|
||||
return m_threads[Thread.CurrentThread.ManagedThreadId];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check watched threads. Fire alarm if appropriate.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
WatchdogTimeout callback = OnWatchdogTimeout;
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
ThreadWatchdogInfo timedOut = null;
|
||||
List<ThreadWatchdogInfo> callbackInfos = null;
|
||||
|
||||
lock (m_threads)
|
||||
{
|
||||
|
@ -246,21 +272,31 @@ namespace OpenSim.Framework
|
|||
{
|
||||
if (threadInfo.Thread.ThreadState == ThreadState.Stopped)
|
||||
{
|
||||
timedOut = threadInfo;
|
||||
RemoveThread(threadInfo.Thread.ManagedThreadId);
|
||||
break;
|
||||
|
||||
if (callbackInfos == null)
|
||||
callbackInfos = new List<ThreadWatchdogInfo>();
|
||||
|
||||
callbackInfos.Add(threadInfo);
|
||||
}
|
||||
else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
|
||||
{
|
||||
threadInfo.IsTimedOut = true;
|
||||
timedOut = threadInfo;
|
||||
break;
|
||||
|
||||
if (threadInfo.AlarmIfTimeout)
|
||||
{
|
||||
if (callbackInfos == null)
|
||||
callbackInfos = new List<ThreadWatchdogInfo>();
|
||||
|
||||
callbackInfos.Add(threadInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (timedOut != null)
|
||||
callback(timedOut.Thread, timedOut.LastTick);
|
||||
if (callbackInfos != null)
|
||||
foreach (ThreadWatchdogInfo callbackInfo in callbackInfos)
|
||||
callback(callbackInfo.Thread, callbackInfo.LastTick);
|
||||
}
|
||||
|
||||
m_watchdogTimer.Start();
|
||||
|
|
|
@ -244,8 +244,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
base.Start(m_recvBufferSize, m_asyncPacketHandling);
|
||||
|
||||
// Start the packet processing threads
|
||||
Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(
|
||||
IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
|
||||
Watchdog.StartThread(
|
||||
OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
|
||||
|
||||
m_elapsedMSSinceLastStatReport = Environment.TickCount;
|
||||
}
|
||||
|
||||
|
|
|
@ -1210,7 +1210,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
|||
if (homeScene.TryGetScenePresence(avatarId,out avatar))
|
||||
{
|
||||
KillAUser ku = new KillAUser(avatar,mod);
|
||||
Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true);
|
||||
Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -351,6 +351,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
process,
|
||||
string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName),
|
||||
ThreadPriority.BelowNormal,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1181,7 +1181,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
HeartbeatThread
|
||||
= Watchdog.StartThread(
|
||||
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false);
|
||||
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1219,6 +1219,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
try
|
||||
{
|
||||
m_eventManager.TriggerOnRegionStarted(this);
|
||||
|
||||
// The first frame can take a very long time due to physics actors being added on startup. Therefore,
|
||||
// don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
|
||||
// alarms for scenes with many objects.
|
||||
Update();
|
||||
Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
|
||||
|
||||
while (!shuttingdown)
|
||||
Update();
|
||||
}
|
||||
|
@ -1244,7 +1251,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
++Frame;
|
||||
|
||||
// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame);
|
||||
// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1406,26 +1413,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
throw;
|
||||
}
|
||||
catch (AccessViolationException e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[REGION]: Failed on region {0} with exception {1}{2}",
|
||||
RegionInfo.RegionName, e.Message, e.StackTrace);
|
||||
}
|
||||
//catch (NullReferenceException e)
|
||||
//{
|
||||
// m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
|
||||
//}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[REGION]: Failed on region {0} with exception {1}{2}",
|
||||
RegionInfo.RegionName, e.Message, e.StackTrace);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[REGION]: Failed on region {0} with exception {1}{2}",
|
||||
"[SCENE]: Failed on region {0} with exception {1}{2}",
|
||||
RegionInfo.RegionName, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
|
@ -1467,7 +1458,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
entry.checkAtTargets();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send out simstats data to all clients
|
||||
/// </summary>
|
||||
|
|
|
@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// that the region position is cached or performance will degrade
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
bool v = true;
|
||||
if (! simulatorList.Contains(dest.ServerURI))
|
||||
// bool v = true;
|
||||
if (!simulatorList.Contains(dest.ServerURI))
|
||||
{
|
||||
// we havent seen this simulator before, add it to the list
|
||||
// and send it an update
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
m_client = client;
|
||||
m_scene = scene;
|
||||
|
||||
Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true);
|
||||
}
|
||||
|
||||
private void SendServerCommand(string command)
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
|
||||
m_listener.Start(50);
|
||||
|
||||
Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true);
|
||||
m_baseScene = baseScene;
|
||||
}
|
||||
|
||||
|
|
|
@ -1474,6 +1474,8 @@ Console.WriteLine("CreateGeom:");
|
|||
/// </summary>
|
||||
private void changeadd()
|
||||
{
|
||||
// m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name);
|
||||
|
||||
int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
|
||||
IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position);
|
||||
|
||||
|
|
|
@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (cmdHandlerThread == null)
|
||||
{
|
||||
// Start the thread that will be doing the work
|
||||
cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true);
|
||||
cmdHandlerThread
|
||||
= Watchdog.StartThread(
|
||||
CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6834,16 +6834,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
}
|
||||
|
||||
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
|
||||
protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
// LSL quaternions can normalize to 0, normal Quaternions can't.
|
||||
if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
|
||||
rot.z = 1; // ZERO_ROTATION = 0,0,0,1
|
||||
|
||||
m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
|
||||
m_host.SitTargetOrientation = Rot2Quaternion(rot);
|
||||
m_host.ParentGroup.HasGroupChanged = true;
|
||||
part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
|
||||
part.SitTargetOrientation = Rot2Quaternion(rot);
|
||||
part.ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
|
||||
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
SitTarget(m_host, offset, rot);
|
||||
}
|
||||
|
||||
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (link == ScriptBaseClass.LINK_ROOT)
|
||||
SitTarget(m_host.ParentGroup.RootPart, offset, rot);
|
||||
else if (link == ScriptBaseClass.LINK_THIS)
|
||||
SitTarget(m_host, offset, rot);
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
|
||||
if (null != part)
|
||||
{
|
||||
SitTarget(part, offset, rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LSL_String llAvatarOnSitTarget()
|
||||
|
|
|
@ -2779,7 +2779,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
|
||||
m_host.AddScriptLPS(1);
|
||||
ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
|
||||
avatar.SpeedModifier = (float)SpeedModifier;
|
||||
|
||||
if (avatar != null)
|
||||
avatar.SpeedModifier = (float)SpeedModifier;
|
||||
}
|
||||
|
||||
public void osKickAvatar(string FirstName,string SurName,string alert)
|
||||
|
|
|
@ -220,6 +220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
LSL_String llGetDisplayName(string id);
|
||||
LSL_String llRequestDisplayName(string id);
|
||||
void llLinkParticleSystem(int linknum, LSL_List rules);
|
||||
void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot);
|
||||
LSL_String llList2CSV(LSL_List src);
|
||||
LSL_Float llList2Float(LSL_List src, int index);
|
||||
LSL_Integer llList2Integer(LSL_List src, int index);
|
||||
|
|
|
@ -1710,6 +1710,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
m_LSL_Functions.llSitTarget(offset, rot);
|
||||
}
|
||||
|
||||
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_LSL_Functions.llLinkSitTarget(link, offset, rot);
|
||||
}
|
||||
|
||||
public void llSleep(double sec)
|
||||
{
|
||||
m_LSL_Functions.llSleep(sec);
|
||||
|
|
|
@ -83,6 +83,9 @@ namespace OpenSim.Region.UserStatistics
|
|||
{
|
||||
if (m_scenes.Count == 0)
|
||||
{
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
||||
|
||||
//IConfig startupConfig = config.Configs["Startup"];
|
||||
|
||||
dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3");
|
||||
|
|
Loading…
Reference in New Issue