Still chasing logout memory leak. Putting in small changes and temporary light verbosity to this end

ThreadPoolClientBranch
Justin Clarke Casey 2008-02-08 22:39:08 +00:00
parent b63c267f0b
commit f05f583613
6 changed files with 39 additions and 12 deletions

View File

@ -26,6 +26,7 @@
* *
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
@ -70,7 +71,9 @@ namespace OpenSim.Framework
public void Remove(uint id) public void Remove(uint id)
{ {
//m_log.Info(String.Format("[CLIENT]: Removing client with code {0}, current count {1}", id, m_clients.Count));
m_clients.Remove(id); m_clients.Remove(id);
m_log.Info(String.Format("[CLIENT]: Removed client with code {0}, new client count {1}", id, m_clients.Count));
} }
public void Add(uint id, IClientAPI client) public void Add(uint id, IClientAPI client)

View File

@ -103,12 +103,22 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
/// <summary>
/// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed.
/// </summary>
/// <param name="transactionID"></param>
/// <returns>The asset if the upload has completed, null if it has not.</returns>
public AssetBase GetTransactionAsset(LLUUID transactionID) public AssetBase GetTransactionAsset(LLUUID transactionID)
{ {
if (XferUploaders.ContainsKey(transactionID)) if (XferUploaders.ContainsKey(transactionID))
{ {
return XferUploaders[transactionID].GetAssetData(); AssetXferUploader uploader = XferUploaders[transactionID];
AssetBase asset = uploader.GetAssetData();
XferUploaders.Remove(transactionID);
return asset;
} }
return null; return null;
} }
@ -237,6 +247,7 @@ namespace OpenSim.Framework.Communications.Cache
SaveAssetToFile(filename, Asset.Data); SaveAssetToFile(filename, Asset.Data);
} }
} }
///Left this in and commented in case there are unforseen issues ///Left this in and commented in case there are unforseen issues
//private void SaveAssetToFile(string filename, byte[] data) //private void SaveAssetToFile(string filename, byte[] data)
//{ //{
@ -311,10 +322,6 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
public void UpdateInventoryItem(LLUUID itemID)
{
}
public AssetBase GetAssetData() public AssetBase GetAssetData()
{ {
if (m_finished) if (m_finished)

View File

@ -53,7 +53,7 @@ namespace OpenSim.Region.ClientStack
{ {
~ClientView() ~ClientView()
{ {
m_log.Info("[CLIENTVIEW]: Dstructor called"); System.Console.WriteLine("[CLIENTVIEW]: Destructor called");
} }
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@ -237,6 +237,10 @@ namespace OpenSim.Region.ClientStack
private void CloseCleanup() private void CloseCleanup()
{ {
m_scene.RemoveClient(AgentId); m_scene.RemoveClient(AgentId);
//m_log.Info(String.Format("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)));
//m_log.Info(String.Format("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)));
// Send the STOP packet // Send the STOP packet
DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
OutPacket(disable, ThrottleOutPacketType.Task); OutPacket(disable, ThrottleOutPacketType.Task);
@ -264,6 +268,11 @@ namespace OpenSim.Region.ClientStack
m_clientThread.Abort(); m_clientThread.Abort();
} }
/// <summary>
/// Close down the client view. This *must* be the last method called, since the last #
/// statement of CloseCleanup() aborts the thread.
/// </summary>
/// <param name="ShutdownCircult"></param>
public void Close(bool ShutdownCircult) public void Close(bool ShutdownCircult)
{ {
// Pull Client out of Region // Pull Client out of Region
@ -273,7 +282,6 @@ namespace OpenSim.Region.ClientStack
if (ShutdownCircult) if (ShutdownCircult)
OnConnectionClosed(this); OnConnectionClosed(this);
CloseCleanup(); CloseCleanup();
} }

View File

@ -25,6 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using libsecondlife; using libsecondlife;
@ -133,13 +135,17 @@ namespace OpenSim.Region.ClientStack
//m_scene.ClientManager.CloseAllAgents(circuitcode); //m_scene.ClientManager.CloseAllAgents(circuitcode);
} }
/// <summary>
/// Completely close down the given client.
/// </summary>
/// <param name="client"></param>
public virtual void CloseClient(IClientAPI client) public virtual void CloseClient(IClientAPI client)
{ {
//m_log.Info("PacketServer:CloseClient()"); m_log.Info("PacketServer:CloseClient()");
CloseCircuit(client.CircuitCode); CloseCircuit(client.CircuitCode);
m_scene.ClientManager.Remove(client.CircuitCode);
client.Close(false); client.Close(false);
m_scene.ClientManager.Remove(client.CircuitCode);
} }
} }
} }

View File

@ -1445,7 +1445,10 @@ namespace OpenSim.Region.Environment.Scenes
} }
// Remove client agent from profile, so new logins will work // Remove client agent from profile, so new logins will work
CommsManager.UserService.clearUserAgent(agentID); CommsManager.UserService.clearUserAgent(agentID);
//m_log.Info(String.Format("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)));
//m_log.Info(String.Format("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)));
} }
public override void CloseAllAgents(uint circuitcode) public override void CloseAllAgents(uint circuitcode)

View File

@ -41,7 +41,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
~ScenePresence() ~ScenePresence()
{ {
m_log.Info("[ScenePresence] Destructor called"); System.Console.WriteLine("[ScenePresence] Destructor called");
} }
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);