change threading on GetTexture and getMesh and WebFetch Modules.
parent
f16d36627f
commit
3029080d9b
|
@ -57,10 +57,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
private string m_SceneName = "";
|
|
||||||
private IAssetService m_AssetService;
|
private IAssetService m_AssetService;
|
||||||
private bool m_Enabled = true;
|
private bool m_Enabled = true;
|
||||||
private bool m_IsRunning = false;
|
|
||||||
private string m_URL;
|
private string m_URL;
|
||||||
|
|
||||||
private string m_URL2;
|
private string m_URL2;
|
||||||
|
@ -89,8 +87,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
private IAssetService m_assetService = null;
|
private IAssetService m_assetService = null;
|
||||||
|
|
||||||
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
|
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
|
||||||
private Thread[] m_workerThreads = null;
|
private static Thread[] m_workerThreads = null;
|
||||||
|
private static int m_NumberScenes = 0;
|
||||||
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
|
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
|
||||||
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
||||||
|
|
||||||
|
@ -146,7 +144,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||||
m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
|
m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
|
||||||
m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
|
m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
|
||||||
|
m_NumberScenes--;
|
||||||
m_scene = null;
|
m_scene = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,8 +160,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
|
m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
|
||||||
m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
|
m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
|
||||||
|
|
||||||
m_IsRunning = true;
|
m_NumberScenes++;
|
||||||
m_SceneName = m_scene.Name;
|
|
||||||
|
|
||||||
if (m_workerThreads == null)
|
if (m_workerThreads == null)
|
||||||
{
|
{
|
||||||
|
@ -172,7 +169,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
for (uint i = 0; i < 2; i++)
|
for (uint i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests,
|
m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests,
|
||||||
String.Format("GetMeshWorker[{0}]{1}",m_SceneName, i),
|
String.Format("GetMeshWorker{0}", i),
|
||||||
ThreadPriority.Normal,
|
ThreadPriority.Normal,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
@ -184,23 +181,22 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
if(m_IsRunning && m_workerThreads != null)
|
if(m_NumberScenes <= 0 && m_workerThreads != null)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[GetMeshModule] Closing{0}", m_SceneName);
|
m_log.DebugFormat("[GetMeshModule] Closing");
|
||||||
m_IsRunning = false;
|
|
||||||
foreach (Thread t in m_workerThreads)
|
foreach (Thread t in m_workerThreads)
|
||||||
Watchdog.AbortThread(t.ManagedThreadId);
|
Watchdog.AbortThread(t.ManagedThreadId);
|
||||||
|
m_queue.Clear();
|
||||||
}
|
}
|
||||||
m_queue.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get { return "GetMeshModule"; } }
|
public string Name { get { return "GetMeshModule"; } }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void DoMeshRequests()
|
private static void DoMeshRequests()
|
||||||
{
|
{
|
||||||
while (m_IsRunning)
|
while(true)
|
||||||
{
|
{
|
||||||
aPollRequest poolreq = m_queue.Dequeue();
|
aPollRequest poolreq = m_queue.Dequeue();
|
||||||
Watchdog.UpdateThread();
|
Watchdog.UpdateThread();
|
||||||
|
@ -299,6 +295,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
UUID requestID = requestinfo.reqID;
|
UUID requestID = requestinfo.reqID;
|
||||||
|
|
||||||
|
if(m_scene.ShuttingDown)
|
||||||
|
return;
|
||||||
|
|
||||||
// If the avatar is gone, don't bother to get the texture
|
// If the avatar is gone, don't bother to get the texture
|
||||||
if (m_scene.GetScenePresence(Id) == null)
|
if (m_scene.GetScenePresence(Id) == null)
|
||||||
{
|
{
|
||||||
|
@ -410,7 +409,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
User = puser;
|
User = puser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses)
|
public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses)
|
||||||
{
|
{
|
||||||
const float ThirtyPercent = 0.30f;
|
const float ThirtyPercent = 0.30f;
|
||||||
|
@ -492,7 +490,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
PassTime();
|
PassTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void PassTime()
|
private void PassTime()
|
||||||
{
|
{
|
||||||
currenttime = Util.EnvironmentTickCount();
|
currenttime = Util.EnvironmentTickCount();
|
||||||
|
@ -511,6 +508,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AlterThrottle(int setting, ScenePresence p)
|
private void AlterThrottle(int setting, ScenePresence p)
|
||||||
{
|
{
|
||||||
p.ControllingClient.SetAgentThrottleSilent((int)Throttle,setting);
|
p.ControllingClient.SetAgentThrottleSilent((int)Throttle,setting);
|
||||||
|
|
|
@ -75,17 +75,15 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
private IAssetService m_assetService = null;
|
private IAssetService m_assetService = null;
|
||||||
|
|
||||||
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
|
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
|
||||||
private Thread[] m_workerThreads = null;
|
private static Thread[] m_workerThreads = null;
|
||||||
|
private static int m_NumberScenes = 0;
|
||||||
private string m_Url = "localhost";
|
|
||||||
|
|
||||||
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
|
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
|
||||||
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
||||||
|
|
||||||
private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
|
private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
|
||||||
|
|
||||||
private bool m_IsRunning = false;
|
private string m_Url = "localhost";
|
||||||
private string m_SceneName = "";
|
|
||||||
#region ISharedRegionModule Members
|
#region ISharedRegionModule Members
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
|
@ -117,6 +115,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||||
m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
|
m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
|
||||||
m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
|
m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
|
||||||
|
m_NumberScenes--;
|
||||||
m_scene = null;
|
m_scene = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,8 +128,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
|
m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
|
||||||
m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
|
m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
|
||||||
|
|
||||||
m_SceneName = m_scene.Name;
|
m_NumberScenes++;
|
||||||
m_IsRunning = true;
|
|
||||||
|
|
||||||
if (m_workerThreads == null)
|
if (m_workerThreads == null)
|
||||||
{
|
{
|
||||||
|
@ -139,7 +137,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
for (uint i = 0; i < 2; i++)
|
for (uint i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests,
|
m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests,
|
||||||
String.Format("GetTextureWorker[{0}]{1}",m_SceneName, i),
|
String.Format("GetTextureWorker{0}", i),
|
||||||
ThreadPriority.Normal,
|
ThreadPriority.Normal,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
@ -194,14 +192,15 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
if(m_IsRunning && m_workerThreads != null)
|
if(m_NumberScenes <= 0 && m_workerThreads != null)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[GetTextureModule] Closing {0}", m_SceneName);
|
m_log.DebugFormat("[GetTextureModule] Closing");
|
||||||
m_IsRunning = false;
|
|
||||||
foreach (Thread t in m_workerThreads)
|
foreach (Thread t in m_workerThreads)
|
||||||
Watchdog.AbortThread(t.ManagedThreadId);
|
Watchdog.AbortThread(t.ManagedThreadId);
|
||||||
|
|
||||||
|
m_queue.Clear();
|
||||||
}
|
}
|
||||||
m_queue.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get { return "GetTextureModule"; } }
|
public string Name { get { return "GetTextureModule"; } }
|
||||||
|
@ -302,11 +301,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
UUID requestID = requestinfo.reqID;
|
UUID requestID = requestinfo.reqID;
|
||||||
|
|
||||||
|
if(m_scene.ShuttingDown)
|
||||||
|
return;
|
||||||
|
|
||||||
if (requestinfo.send503)
|
if (requestinfo.send503)
|
||||||
{
|
{
|
||||||
response = new Hashtable();
|
response = new Hashtable();
|
||||||
|
|
||||||
|
|
||||||
response["int_response_code"] = 503;
|
response["int_response_code"] = 503;
|
||||||
response["str_response_string"] = "Throttled";
|
response["str_response_string"] = "Throttled";
|
||||||
response["content_type"] = "text/plain";
|
response["content_type"] = "text/plain";
|
||||||
|
@ -408,9 +409,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoTextureRequests()
|
private static void DoTextureRequests()
|
||||||
{
|
{
|
||||||
while (m_IsRunning)
|
while (true)
|
||||||
{
|
{
|
||||||
aPollRequest poolreq = m_queue.Dequeue();
|
aPollRequest poolreq = m_queue.Dequeue();
|
||||||
Watchdog.UpdateThread();
|
Watchdog.UpdateThread();
|
||||||
|
|
|
@ -102,6 +102,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
private static DoubleQueue<aPollRequest> m_queue =
|
private static DoubleQueue<aPollRequest> m_queue =
|
||||||
new DoubleQueue<aPollRequest>();
|
new DoubleQueue<aPollRequest>();
|
||||||
|
|
||||||
|
private static int m_NumberScenes = 0;
|
||||||
|
|
||||||
#region ISharedRegionModule Members
|
#region ISharedRegionModule Members
|
||||||
|
|
||||||
public WebFetchInvDescModule() : this(true) {}
|
public WebFetchInvDescModule() : this(true) {}
|
||||||
|
@ -145,17 +147,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
StatsManager.DeregisterStat(s_processedRequestsStat);
|
StatsManager.DeregisterStat(s_processedRequestsStat);
|
||||||
StatsManager.DeregisterStat(s_queuedRequestsStat);
|
StatsManager.DeregisterStat(s_queuedRequestsStat);
|
||||||
|
|
||||||
if (ProcessQueuedRequestsAsync)
|
m_NumberScenes--;
|
||||||
{
|
|
||||||
if (m_workerThreads != null)
|
|
||||||
{
|
|
||||||
foreach (Thread t in m_workerThreads)
|
|
||||||
Watchdog.AbortThread(t.ManagedThreadId);
|
|
||||||
|
|
||||||
m_workerThreads = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Scene = null;
|
Scene = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,6 +195,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
Scene.EventManager.OnRegisterCaps += RegisterCaps;
|
Scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||||
|
|
||||||
|
m_NumberScenes++;
|
||||||
|
|
||||||
int nworkers = 2; // was 2
|
int nworkers = 2; // was 2
|
||||||
if (ProcessQueuedRequestsAsync && m_workerThreads == null)
|
if (ProcessQueuedRequestsAsync && m_workerThreads == null)
|
||||||
{
|
{
|
||||||
|
@ -225,7 +219,23 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close() { }
|
public void Close()
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ProcessQueuedRequestsAsync)
|
||||||
|
{
|
||||||
|
if (m_NumberScenes <= 0 && m_workerThreads != null)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[WebFetchInvDescModule] Closing");
|
||||||
|
foreach (Thread t in m_workerThreads)
|
||||||
|
Watchdog.AbortThread(t.ManagedThreadId);
|
||||||
|
|
||||||
|
m_workerThreads = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string Name { get { return "WebFetchInvDescModule"; } }
|
public string Name { get { return "WebFetchInvDescModule"; } }
|
||||||
|
|
||||||
|
@ -350,6 +360,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
public void Process(aPollRequest requestinfo)
|
public void Process(aPollRequest requestinfo)
|
||||||
{
|
{
|
||||||
|
if(m_module == null || m_module.Scene == null || m_module.Scene.ShuttingDown)
|
||||||
|
return;
|
||||||
|
|
||||||
UUID requestID = requestinfo.reqID;
|
UUID requestID = requestinfo.reqID;
|
||||||
|
|
||||||
Hashtable response = new Hashtable();
|
Hashtable response = new Hashtable();
|
||||||
|
@ -425,31 +438,26 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private void DoInventoryRequests()
|
private static void DoInventoryRequests()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Watchdog.UpdateThread();
|
Watchdog.UpdateThread();
|
||||||
|
|
||||||
WaitProcessQueuedInventoryRequest();
|
aPollRequest poolreq = m_queue.Dequeue();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WaitProcessQueuedInventoryRequest()
|
if (poolreq != null && poolreq.thepoll != null)
|
||||||
{
|
|
||||||
aPollRequest poolreq = m_queue.Dequeue();
|
|
||||||
|
|
||||||
if (poolreq != null && poolreq.thepoll != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
poolreq.thepoll.Process(poolreq);
|
try
|
||||||
}
|
{
|
||||||
catch (Exception e)
|
poolreq.thepoll.Process(poolreq);
|
||||||
{
|
}
|
||||||
m_log.ErrorFormat(
|
catch (Exception e)
|
||||||
"[INVENTORY]: Failed to process queued inventory request {0} for {1} in {2}. Exception {3}",
|
{
|
||||||
poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", Scene.Name, e);
|
m_log.ErrorFormat(
|
||||||
|
"[INVENTORY]: Failed to process queued inventory request {0} for {1}. Exception {3}",
|
||||||
|
poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue