From ff098ae110bb3175fe6a7bf37a03e3f22eb829e3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 13 Sep 2010 20:44:32 +0100 Subject: [PATCH 1/9] minor: Clean up log messages generated when an item is attached --- .../Avatar/Attachments/AttachmentsModule.cs | 6 ++++-- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 +++--------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 5604f490f2..a3712d14c1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -218,14 +218,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) { - m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); - return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true); } public UUID RezSingleAttachmentFromInventory( IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) { + m_log.DebugFormat( + "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", + (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); + SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); if (updateInventoryStatus) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 7e5a8ec9f1..22c89370a7 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -198,7 +198,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public void UpdateDatabase(UUID user, AvatarAppearance appearance) { - m_log.DebugFormat("[APPEARANCE]: UpdateDatabase"); + //m_log.DebugFormat("[APPEARANCE]: UpdateDatabase"); AvatarData adata = new AvatarData(appearance); m_scene.AvatarService.SetAvatar(user, adata); } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 177cf1e742..51a0f2ac90 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3727,8 +3727,8 @@ namespace OpenSim.Region.Framework.Scenes return; UUID itemID = m_appearance.GetAttachedItem(p); - UUID assetID = m_appearance.GetAttachedAsset(p); + //UUID assetID = m_appearance.GetAttachedAsset(p); // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down // But they're not used anyway, the item is being looked up for now, so let's proceed. //if (UUID.Zero == assetID) @@ -3739,17 +3739,11 @@ namespace OpenSim.Region.Framework.Scenes try { - // Rez from inventory - UUID asset - = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p); - - m_log.InfoFormat( - "[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})", - p, itemID, assetID, asset); + m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p); } catch (Exception e) { - m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}", e.ToString()); + m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace); } } } From 366de0a7b57919625429db571f4ed4a231f043da Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 13 Sep 2010 20:58:50 +0100 Subject: [PATCH 2/9] If attachment fails (e.g. because asset wasn't found) then don't try to set attachment as shown in inventory Doing this results in a null reference exception --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index a3712d14c1..b7ecb55126 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -233,11 +233,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (updateInventoryStatus) { if (att == null) - { ShowDetachInUserInventory(itemID, remoteClient); - } - - SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt); + else + SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt); } if (null == att) From cd153a20b7e50edfa6a8c0098a456876b3088adf Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 13 Sep 2010 21:05:03 +0100 Subject: [PATCH 3/9] Remove IAttachmentsModule.SetAttachmentInventoryStatus() from public interface No core module is calling and it makes more sense to call methods such as AttachObject() which attach both to the avatar and update inventory appropriately --- .../Avatar/Attachments/AttachmentsModule.cs | 18 +++++++++++++----- .../Framework/Interfaces/IAttachmentsModule.cs | 11 ----------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index b7ecb55126..fe190994ff 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -300,12 +300,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return null; } - public UUID SetAttachmentInventoryStatus( + /// + /// Update the user inventory to the attachment of an item + /// + /// + /// + /// + /// + /// + protected UUID SetAttachmentInventoryStatus( SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) { - m_log.DebugFormat( - "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})", - remoteClient.Name, att.Name, itemID); +// m_log.DebugFormat( +// "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})", +// remoteClient.Name, att.Name, itemID); if (!att.IsDeleted) AttachmentPt = att.RootPart.AttachmentPoint; @@ -387,7 +395,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Save avatar attachment information if (m_scene.AvatarFactory != null) { - m_log.Debug("[ATTACHMENTS MODULE]: Dettaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); + m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); } } diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 1140b9b8dc..24e481b2bd 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -109,17 +109,6 @@ namespace OpenSim.Region.Framework.Interfaces /// /// void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient); - - /// - /// Update the user inventory to the attachment of an item - /// - /// - /// - /// - /// - /// - UUID SetAttachmentInventoryStatus( - SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt); /// /// Update the user inventory to show a detach. From ae1a0150a1951d8cee67b253aa63301fdafbff89 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 13 Sep 2010 21:15:12 +0100 Subject: [PATCH 4/9] Rename now protected method SetAttachmentInventoryStatus() to ShowAttachInUserInventory() to match ShowDetachInUserInventory() --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index fe190994ff..1ebac42cf7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments itemID = group.GetFromItemID(); } - SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group); + ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group); AttachToAgent(sp, group, AttachmentPt, attachPos, silent); } @@ -235,7 +235,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (att == null) ShowDetachInUserInventory(itemID, remoteClient); else - SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt); + ShowAttachInUserInventory(att, remoteClient, itemID, AttachmentPt); } if (null == att) @@ -308,7 +308,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// /// /// - protected UUID SetAttachmentInventoryStatus( + protected UUID ShowAttachInUserInventory( SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) { // m_log.DebugFormat( @@ -337,7 +337,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// /// /// - public void SetAttachmentInventoryStatus( + protected void ShowAttachInUserInventory( IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) { // m_log.DebugFormat( From 7ae926618612a76bf143b1cbcd6e420828becb5a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 13 Sep 2010 21:20:31 +0100 Subject: [PATCH 5/9] Remove SceneGraph.DetachObject() which was accidentally left around after being migrated to AttachmentsModule --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 5ac8ff5fef..85ff32eb17 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -522,16 +522,6 @@ namespace OpenSim.Region.Framework.Scenes m_parentScene.AttachmentsModule.DetachSingleAttachmentToGround(group.UUID, remoteClient); } - protected internal void DetachObject(uint objectLocalID, IClientAPI remoteClient) - { - SceneObjectGroup group = GetGroupByPrim(objectLocalID); - if (group != null) - { - //group.DetachToGround(); - m_parentScene.AttachmentsModule.ShowDetachInUserInventory(group.GetFromItemID(), remoteClient); - } - } - protected internal void HandleUndo(IClientAPI remoteClient, UUID primId) { if (primId != UUID.Zero) From e4858b0eeb25c6a43d615c241d1566a92ae278a5 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 13 Sep 2010 21:28:42 +0100 Subject: [PATCH 6/9] Add client name to packet resend log messages to make them a bit more informative --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index ca5a297f19..56e8c9be54 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -695,9 +695,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (packet.Header.Reliable && !udpClient.PacketArchive.TryEnqueue(packet.Header.Sequence)) { if (packet.Header.Resent) - m_log.Debug("[LLUDPSERVER]: Received a resend of already processed packet #" + packet.Header.Sequence + ", type: " + packet.Type); - else - m_log.Warn("[LLUDPSERVER]: Received a duplicate (not marked as resend) of packet #" + packet.Header.Sequence + ", type: " + packet.Type); + m_log.DebugFormat( + "[LLUDPSERVER]: Received a resend of already processed packet #{0}, type {1} from {2}", + packet.Header.Sequence, packet.Type, client.Name); + else + m_log.WarnFormat( + "[LLUDPSERVER]: Received a duplicate (not marked as resend) of packet #{0}, type {1} from {2}", + packet.Header.Sequence, packet.Type, client.Name); // Avoid firing a callback twice for the same packet return; From fbe72e30ebc46f07da912bbeabdf252150f7effc Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 13 Sep 2010 21:52:36 +0100 Subject: [PATCH 7/9] Improve generic message exception logging. Quieten down complaints about unhandled GenericMessages --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f35691acb5..0aa670a829 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -5199,11 +5199,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP } catch (Exception e) { - m_log.Error("[GENERICMESSAGE] " + e); + m_log.ErrorFormat( + "[LLCLIENTVIEW]: Exeception when handling generic message {0}{1}", e.Message, e.StackTrace); } } } - m_log.Error("[GENERICMESSAGE] Not handling GenericMessage with method-type of: " + method); + + //m_log.Debug("[LLCLIENTVIEW]: Not handling GenericMessage with method-type of: " + method); return false; } From dd803b4f0c50c4ac1eda5ae7622dc91b2a63db3f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 13 Sep 2010 21:53:25 +0100 Subject: [PATCH 8/9] minor: Add comments which explain what's going on wrt avatar movements at various points in the main scene loop and associated methods --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6d2ae5a70c..ef97dfc985 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1319,6 +1319,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_frame % m_update_presences == 0) m_sceneGraph.UpdatePresences(); + // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) if (m_frame % m_update_coarse_locations == 0) { List coarseLocations; @@ -1336,9 +1337,12 @@ namespace OpenSim.Region.Framework.Scenes m_sceneGraph.UpdatePreparePhysics(); physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); + // Apply any pending avatar force input to the avatar's velocity if (m_frame % m_update_entitymovement == 0) m_sceneGraph.UpdateScenePresenceMovement(); + // Perform the main physics update. This will do the actual work of moving objects and avatars according to their + // velocity int tmpPhysicsMS = Util.EnvironmentTickCount(); if (m_frame % m_update_physics == 0) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 51a0f2ac90..a77f38c01a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1522,6 +1522,8 @@ namespace OpenSim.Region.Framework.Scenes } } + // If the agent update does move the avatar, then calculate the force ready for the velocity update, + // which occurs later in the main scene loop if (update_movementflag || (update_rotation && DCFlagKeyPressed)) { // m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed)); From 36f81c66e51e84d8ce7bd40860ed78e9c2a108c2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 14 Sep 2010 00:05:38 +0100 Subject: [PATCH 9/9] Comment out SOG storing debug log message This can get very spammy with regularly changing objects. Please uncomment if required. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 2c1f207f7e..dc6509d5ac 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1430,9 +1430,9 @@ namespace OpenSim.Region.Framework.Scenes // don't backup while it's selected or you're asking for changes mid stream. if (isTimeToPersist() || forcedBackup) { - m_log.DebugFormat( - "[SCENE]: Storing {0}, {1} in {2}", - Name, UUID, m_scene.RegionInfo.RegionName); +// m_log.DebugFormat( +// "[SCENE]: Storing {0}, {1} in {2}", +// Name, UUID, m_scene.RegionInfo.RegionName); SceneObjectGroup backup_group = Copy(false); backup_group.RootPart.Velocity = RootPart.Velocity;