From 1f2404aa29249f94ec987a0fe9e9cc5fa1cd634b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 18 Feb 2015 16:44:36 -0500 Subject: Logging for attachments and their COF links --- indra/newview/llattachmentsmgr.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 256980eb04..d7c4a24fb5 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -60,6 +60,8 @@ void LLAttachmentsMgr::onIdle(void *) LLAttachmentsMgr::instance().onIdle(); } +// FIXME this is basically the same code as LLAgentWearables::userAttachMultipleAttachments(), +// should consolidate. void LLAttachmentsMgr::onIdle() { // Make sure we got a region before trying anything else @@ -73,7 +75,8 @@ void LLAttachmentsMgr::onIdle() { return; } - + LL_DEBUGS("Avatar") << "attaching multiple, total obj_count " << obj_count << LL_ENDL; + // Limit number of packets to send const S32 MAX_PACKETS_TO_SEND = 10; const S32 OBJECTS_PER_PACKET = 4; @@ -113,6 +116,8 @@ void LLAttachmentsMgr::onIdle() LL_INFOS() << "Attempted to add non-existant item ID:" << attachment.mItemID << LL_ENDL; continue; } + LL_DEBUGS("Avatar") << "requesting " << item->getName() + << " " << item->getLinkedUUID() << LL_ENDL; S32 attachment_pt = attachment.mAttachmentPt; if (attachment.mAdd) attachment_pt |= ATTACHMENT_ADD; -- cgit v1.2.3 From 7b99314d846483167c665fabf8092e604554321c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 20 Feb 2015 15:54:27 -0500 Subject: MAINT-4653, DRTVWR-397 WIP - more code for tracking attachment operations, smarter handling of multiple requests. --- indra/newview/llattachmentsmgr.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index d7c4a24fb5..8103d89955 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -47,6 +47,10 @@ void LLAttachmentsMgr::addAttachment(const LLUUID& item_id, const U8 attachment_pt, const BOOL add) { + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LL_DEBUGS("Avatar") << "ATT adding attachment to mPendingAttachments " + << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; + AttachmentsInfo attachment; attachment.mItemID = item_id; attachment.mAttachmentPt = attachment_pt; @@ -75,7 +79,7 @@ void LLAttachmentsMgr::onIdle() { return; } - LL_DEBUGS("Avatar") << "attaching multiple, total obj_count " << obj_count << LL_ENDL; + LL_DEBUGS("Avatar") << "ATT [RezMultipleAttachmentsFromInv] attaching multiple from mPendingAttachments, total obj_count " << obj_count << LL_ENDL; // Limit number of packets to send const S32 MAX_PACKETS_TO_SEND = 10; @@ -113,10 +117,10 @@ void LLAttachmentsMgr::onIdle() LLViewerInventoryItem* item = gInventory.getItem(attachment.mItemID); if (!item) { - LL_INFOS() << "Attempted to add non-existant item ID:" << attachment.mItemID << LL_ENDL; + LL_INFOS() << "Attempted to add non-existent item ID:" << attachment.mItemID << LL_ENDL; continue; } - LL_DEBUGS("Avatar") << "requesting " << item->getName() + LL_DEBUGS("Avatar") << "ATT requesting from mPendingAttachments " << item->getName() << " " << item->getLinkedUUID() << LL_ENDL; S32 attachment_pt = attachment.mAttachmentPt; if (attachment.mAdd) -- cgit v1.2.3 From 58ab202aa2615df8038ac8c47e2f170c06a990a6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 24 Feb 2015 16:19:14 -0500 Subject: MAINT-4917 WIP - batch COF link request before batch attachment request. Should only generate one bake request. --- indra/newview/llattachmentsmgr.cpp | 90 ++++++++++++++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 8 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 8103d89955..a38bae207d 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -28,6 +28,7 @@ #include "llattachmentsmgr.h" #include "llagent.h" +#include "llappearancemgr.h" #include "llinventorymodel.h" #include "lltooldraganddrop.h" // pack_permissions_slam #include "llviewerinventory.h" @@ -64,9 +65,83 @@ void LLAttachmentsMgr::onIdle(void *) LLAttachmentsMgr::instance().onIdle(); } +void LLAttachmentsMgr::onIdle() +{ + // Make sure we got a region before trying anything else + if( !gAgent.getRegion() ) + { + return; + } + + linkPendingAttachments(); +} + +class LLAttachAfterLinkCallback: public LLInventoryCallback +{ +public: + LLAttachAfterLinkCallback(const LLAttachmentsMgr::attachments_vec_t& to_link_and_attach): + mToLinkAndAttach(to_link_and_attach) + { + } + + ~LLAttachAfterLinkCallback() + { + LL_DEBUGS("Avatar") << "destructor" << LL_ENDL; + for (LLAttachmentsMgr::attachments_vec_t::const_iterator it = mToLinkAndAttach.begin(); + it != mToLinkAndAttach.end(); ++it) + { + const LLAttachmentsMgr::AttachmentsInfo& att_info = *it; + if (!LLAppearanceMgr::instance().isLinkedInCOF(att_info.mItemID)) + { + LLViewerInventoryItem *item = gInventory.getItem(att_info.mItemID); + LL_WARNS() << "ATT COF link creation failed for att item " << (item ? item->getName() : "UNKNOWN") << " id " + << att_info.mItemID << LL_ENDL; + } + } + LLAppearanceMgr::instance().requestServerAppearanceUpdate(); + LLAttachmentsMgr::instance().requestAttachments(mToLinkAndAttach); + } + + /* virtual */ void fire(const LLUUID& inv_item) + { + LL_DEBUGS("Avatar") << inv_item << LL_ENDL; + } + +private: + LLAttachmentsMgr::attachments_vec_t mToLinkAndAttach; +}; + +void LLAttachmentsMgr::linkPendingAttachments() +{ + if (mPendingAttachments.size()) + { + LLPointer cb = new LLAttachAfterLinkCallback(mPendingAttachments); + LLInventoryObject::const_object_list_t inv_items_to_link; + for (attachments_vec_t::const_iterator it = mPendingAttachments.begin(); + it != mPendingAttachments.end(); ++it) + { + const AttachmentsInfo& att_info = *it; + LLViewerInventoryItem *item = gInventory.getItem(att_info.mItemID); + if (item) + { + inv_items_to_link.push_back(item); + } + else + { + LL_WARNS() << "ATT unable to link requested attachment " << att_info.mItemID + << ", item not found in inventory" << LL_ENDL; + } + } + link_inventory_array(LLAppearanceMgr::instance().getCOF(), inv_items_to_link, cb); + + mPendingAttachments.clear(); + } + +} + // FIXME this is basically the same code as LLAgentWearables::userAttachMultipleAttachments(), // should consolidate. -void LLAttachmentsMgr::onIdle() +void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_requests) { // Make sure we got a region before trying anything else if( !gAgent.getRegion() ) @@ -74,12 +149,13 @@ void LLAttachmentsMgr::onIdle() return; } - S32 obj_count = mPendingAttachments.size(); + S32 obj_count = attachment_requests.size(); if (obj_count == 0) { return; } - LL_DEBUGS("Avatar") << "ATT [RezMultipleAttachmentsFromInv] attaching multiple from mPendingAttachments, total obj_count " << obj_count << LL_ENDL; + LL_DEBUGS("Avatar") << "ATT [RezMultipleAttachmentsFromInv] attaching multiple from attachment_requests," + " total obj_count " << obj_count << LL_ENDL; // Limit number of packets to send const S32 MAX_PACKETS_TO_SEND = 10; @@ -96,8 +172,8 @@ void LLAttachmentsMgr::onIdle() S32 i = 0; - for (attachments_vec_t::const_iterator iter = mPendingAttachments.begin(); - iter != mPendingAttachments.end(); + for (attachments_vec_t::const_iterator iter = attachment_requests.begin(); + iter != attachment_requests.end(); ++iter) { if( 0 == (i % OBJECTS_PER_PACKET) ) @@ -120,7 +196,7 @@ void LLAttachmentsMgr::onIdle() LL_INFOS() << "Attempted to add non-existent item ID:" << attachment.mItemID << LL_ENDL; continue; } - LL_DEBUGS("Avatar") << "ATT requesting from mPendingAttachments " << item->getName() + LL_DEBUGS("Avatar") << "ATT requesting from attachment_requests " << item->getName() << " " << item->getLinkedUUID() << LL_ENDL; S32 attachment_pt = attachment.mAttachmentPt; if (attachment.mAdd) @@ -141,6 +217,4 @@ void LLAttachmentsMgr::onIdle() } i++; } - - mPendingAttachments.clear(); } -- cgit v1.2.3 From 43aac9ad1d303b24432623e253f568fd82b77a2a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 27 Feb 2015 10:28:50 -0500 Subject: MAINT-4918 WIP - batch up detach requests for objects --- indra/newview/llattachmentsmgr.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index a38bae207d..e64ed6563a 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -117,6 +117,7 @@ void LLAttachmentsMgr::linkPendingAttachments() { LLPointer cb = new LLAttachAfterLinkCallback(mPendingAttachments); LLInventoryObject::const_object_list_t inv_items_to_link; + LL_DEBUGS("Avatar") << "ATT requesting COF links for " << mPendingAttachments.size() << " object(s):" << LL_ENDL; for (attachments_vec_t::const_iterator it = mPendingAttachments.begin(); it != mPendingAttachments.end(); ++it) { @@ -124,6 +125,7 @@ void LLAttachmentsMgr::linkPendingAttachments() LLViewerInventoryItem *item = gInventory.getItem(att_info.mItemID); if (item) { + LL_DEBUGS("Avatar") << "ATT - requesting COF link for " << item->getName() << LL_ENDL; inv_items_to_link.push_back(item); } else -- cgit v1.2.3 From 8169cde890f70320340a08cbfa29d16033572a9b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 3 Mar 2015 17:08:34 -0500 Subject: MAINT-4653 WIP --- indra/newview/llattachmentsmgr.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index e64ed6563a..64dcaab6c0 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -111,10 +111,13 @@ private: LLAttachmentsMgr::attachments_vec_t mToLinkAndAttach; }; +//#define COF_LINK_FIRST + void LLAttachmentsMgr::linkPendingAttachments() { if (mPendingAttachments.size()) { +#ifdef COF_LINK_FIRST LLPointer cb = new LLAttachAfterLinkCallback(mPendingAttachments); LLInventoryObject::const_object_list_t inv_items_to_link; LL_DEBUGS("Avatar") << "ATT requesting COF links for " << mPendingAttachments.size() << " object(s):" << LL_ENDL; @@ -135,7 +138,9 @@ void LLAttachmentsMgr::linkPendingAttachments() } } link_inventory_array(LLAppearanceMgr::instance().getCOF(), inv_items_to_link, cb); - +#else + requestAttachments(mPendingAttachments); +#endif mPendingAttachments.clear(); } -- cgit v1.2.3 From 090d3097d569922b7c3b681cb77ff14a29a60b07 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 18 Mar 2015 21:41:47 -0400 Subject: MAINT-4917 WIP - Attachment deferred bulk COF linking WIP --- indra/newview/llattachmentsmgr.cpp | 133 ++++++++++++++++++++++++++++--------- 1 file changed, 103 insertions(+), 30 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 64dcaab6c0..cc83500491 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -44,9 +44,9 @@ LLAttachmentsMgr::~LLAttachmentsMgr() { } -void LLAttachmentsMgr::addAttachment(const LLUUID& item_id, - const U8 attachment_pt, - const BOOL add) +void LLAttachmentsMgr::addAttachmentRequest(const LLUUID& item_id, + const U8 attachment_pt, + const BOOL add) { LLViewerInventoryItem *item = gInventory.getItem(item_id); LL_DEBUGS("Avatar") << "ATT adding attachment to mPendingAttachments " @@ -57,6 +57,8 @@ void LLAttachmentsMgr::addAttachment(const LLUUID& item_id, attachment.mAttachmentPt = attachment_pt; attachment.mAdd = add; mPendingAttachments.push_back(attachment); + + addAttachmentRequestTime(item_id); } // static @@ -73,7 +75,9 @@ void LLAttachmentsMgr::onIdle() return; } - linkPendingAttachments(); + requestPendingAttachments(); + + linkRecentlyArrivedAttachments(); } class LLAttachAfterLinkCallback: public LLInventoryCallback @@ -111,39 +115,58 @@ private: LLAttachmentsMgr::attachments_vec_t mToLinkAndAttach; }; -//#define COF_LINK_FIRST - -void LLAttachmentsMgr::linkPendingAttachments() +void LLAttachmentsMgr::requestPendingAttachments() { if (mPendingAttachments.size()) { -#ifdef COF_LINK_FIRST - LLPointer cb = new LLAttachAfterLinkCallback(mPendingAttachments); - LLInventoryObject::const_object_list_t inv_items_to_link; - LL_DEBUGS("Avatar") << "ATT requesting COF links for " << mPendingAttachments.size() << " object(s):" << LL_ENDL; - for (attachments_vec_t::const_iterator it = mPendingAttachments.begin(); - it != mPendingAttachments.end(); ++it) - { - const AttachmentsInfo& att_info = *it; - LLViewerInventoryItem *item = gInventory.getItem(att_info.mItemID); - if (item) - { - LL_DEBUGS("Avatar") << "ATT - requesting COF link for " << item->getName() << LL_ENDL; - inv_items_to_link.push_back(item); - } - else - { - LL_WARNS() << "ATT unable to link requested attachment " << att_info.mItemID - << ", item not found in inventory" << LL_ENDL; - } - } - link_inventory_array(LLAppearanceMgr::instance().getCOF(), inv_items_to_link, cb); -#else requestAttachments(mPendingAttachments); -#endif mPendingAttachments.clear(); } +} + +void LLAttachmentsMgr::linkRecentlyArrivedAttachments() +{ + const F32 COF_LINK_BATCH_TIME = 5.0F; + + // One or more attachments have arrived but not been processed for COF links + if (mRecentlyArrivedAttachments.size()) + { + if (mAttachmentRequests.empty()) + { + // Not waiting for more + LL_DEBUGS("Avatar") << "ATT all pending attachments have arrived" << LL_ENDL; + } + else if (mCOFLinkBatchTimer.getElapsedTimeF32() > COF_LINK_BATCH_TIME) + { + LL_DEBUGS("Avatar") << mAttachmentRequests.size() + << "ATT pending attachments have not arrived but wait time exceeded" << LL_ENDL; + } + else + { + return; + } + LL_DEBUGS("Avatar") << "ATT requesting COF links for " << mRecentlyArrivedAttachments.size() << LL_ENDL; + LLInventoryObject::const_object_list_t inv_items_to_link; + for (std::set::iterator it = mRecentlyArrivedAttachments.begin(); + it != mRecentlyArrivedAttachments.end(); ++it) + { + if (!LLAppearanceMgr::instance().isLinkedInCOF(*it)) + { + LLUUID item_id = *it; + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LL_DEBUGS("Avatar") << "ATT adding COF link for attachment " + << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL; + inv_items_to_link.push_back(item); + } + } + if (inv_items_to_link.size()) + { + LLPointer cb = new LLRequestServerAppearanceUpdateOnDestroy(); + link_inventory_array(LLAppearanceMgr::instance().getCOF(), inv_items_to_link, cb); + } + mRecentlyArrivedAttachments.clear(); + } } // FIXME this is basically the same code as LLAgentWearables::userAttachMultipleAttachments(), @@ -225,3 +248,53 @@ void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_re i++; } } + +void LLAttachmentsMgr::addAttachmentRequestTime(const LLUUID& inv_item_id) +{ + LLInventoryItem *item = gInventory.getItem(inv_item_id); + LL_DEBUGS("Avatar") << "ATT add request time " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; + LLTimer current_time; + mAttachmentRequests[inv_item_id] = current_time; +} + +void LLAttachmentsMgr::removeAttachmentRequestTime(const LLUUID& inv_item_id) +{ + LLInventoryItem *item = gInventory.getItem(inv_item_id); + LL_DEBUGS("Avatar") << "ATT remove request time " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; + mAttachmentRequests.erase(inv_item_id); +} + +BOOL LLAttachmentsMgr::attachmentWasRequestedRecently(const LLUUID& inv_item_id, F32 seconds) const +{ + std::map::const_iterator it = mAttachmentRequests.find(inv_item_id); + if (it != mAttachmentRequests.end()) + { + const LLTimer& request_time = it->second; + F32 request_time_elapsed = request_time.getElapsedTimeF32(); + if (request_time_elapsed > seconds) + { + LLInventoryItem *item = gInventory.getItem(inv_item_id); + LL_DEBUGS("Avatar") << "ATT time ignored, exceeded " << seconds + << " " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; + return FALSE; + } + else + { + return TRUE; + } + } + else + { + return FALSE; + } +} + +void LLAttachmentsMgr::onAttachmentArrived(const LLUUID& inv_item_id) +{ + removeAttachmentRequestTime(inv_item_id); + if (mRecentlyArrivedAttachments.empty()) + { + mCOFLinkBatchTimer.reset(); + } + mRecentlyArrivedAttachments.insert(inv_item_id); +} -- cgit v1.2.3 From 8963185f5bea5af8ede04f41423ae1f822d80899 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 19 Mar 2015 17:05:55 -0400 Subject: MAINT-4917 WIP - comments and bug fixes for batching up COF link requests after attachments added. --- indra/newview/llattachmentsmgr.cpp | 187 ++++++++++++++++++++----------------- 1 file changed, 100 insertions(+), 87 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index cc83500491..b00ccd2d40 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" #include "llattachmentsmgr.h" +#include "llvoavatarself.h" #include "llagent.h" #include "llappearancemgr.h" #include "llinventorymodel.h" @@ -35,6 +36,9 @@ #include "llviewerregion.h" #include "message.h" +const F32 COF_LINK_BATCH_TIME = 5.0F; +const F32 MAX_ATTACHMENT_REQUEST_LIFETIME = 30.0F; +const F32 MIN_RETRY_REQUEST_TIME = 5.0F; LLAttachmentsMgr::LLAttachmentsMgr() { @@ -49,6 +53,14 @@ void LLAttachmentsMgr::addAttachmentRequest(const LLUUID& item_id, const BOOL add) { LLViewerInventoryItem *item = gInventory.getItem(item_id); + + if (attachmentWasRequestedRecently(item_id)) + { + LL_DEBUGS("Avatar") << "ATT not adding attachment to mPendingAttachments, recent request is already pending: " + << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; + return; + } + LL_DEBUGS("Avatar") << "ATT adding attachment to mPendingAttachments " << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; @@ -78,42 +90,9 @@ void LLAttachmentsMgr::onIdle() requestPendingAttachments(); linkRecentlyArrivedAttachments(); -} - -class LLAttachAfterLinkCallback: public LLInventoryCallback -{ -public: - LLAttachAfterLinkCallback(const LLAttachmentsMgr::attachments_vec_t& to_link_and_attach): - mToLinkAndAttach(to_link_and_attach) - { - } - - ~LLAttachAfterLinkCallback() - { - LL_DEBUGS("Avatar") << "destructor" << LL_ENDL; - for (LLAttachmentsMgr::attachments_vec_t::const_iterator it = mToLinkAndAttach.begin(); - it != mToLinkAndAttach.end(); ++it) - { - const LLAttachmentsMgr::AttachmentsInfo& att_info = *it; - if (!LLAppearanceMgr::instance().isLinkedInCOF(att_info.mItemID)) - { - LLViewerInventoryItem *item = gInventory.getItem(att_info.mItemID); - LL_WARNS() << "ATT COF link creation failed for att item " << (item ? item->getName() : "UNKNOWN") << " id " - << att_info.mItemID << LL_ENDL; - } - } - LLAppearanceMgr::instance().requestServerAppearanceUpdate(); - LLAttachmentsMgr::instance().requestAttachments(mToLinkAndAttach); - } - - /* virtual */ void fire(const LLUUID& inv_item) - { - LL_DEBUGS("Avatar") << inv_item << LL_ENDL; - } -private: - LLAttachmentsMgr::attachments_vec_t mToLinkAndAttach; -}; + expireOldAttachmentRequests(); +} void LLAttachmentsMgr::requestPendingAttachments() { @@ -124,53 +103,10 @@ void LLAttachmentsMgr::requestPendingAttachments() } } -void LLAttachmentsMgr::linkRecentlyArrivedAttachments() -{ - const F32 COF_LINK_BATCH_TIME = 5.0F; - - // One or more attachments have arrived but not been processed for COF links - if (mRecentlyArrivedAttachments.size()) - { - if (mAttachmentRequests.empty()) - { - // Not waiting for more - LL_DEBUGS("Avatar") << "ATT all pending attachments have arrived" << LL_ENDL; - } - else if (mCOFLinkBatchTimer.getElapsedTimeF32() > COF_LINK_BATCH_TIME) - { - LL_DEBUGS("Avatar") << mAttachmentRequests.size() - << "ATT pending attachments have not arrived but wait time exceeded" << LL_ENDL; - } - else - { - return; - } - - LL_DEBUGS("Avatar") << "ATT requesting COF links for " << mRecentlyArrivedAttachments.size() << LL_ENDL; - LLInventoryObject::const_object_list_t inv_items_to_link; - for (std::set::iterator it = mRecentlyArrivedAttachments.begin(); - it != mRecentlyArrivedAttachments.end(); ++it) - { - if (!LLAppearanceMgr::instance().isLinkedInCOF(*it)) - { - LLUUID item_id = *it; - LLViewerInventoryItem *item = gInventory.getItem(item_id); - LL_DEBUGS("Avatar") << "ATT adding COF link for attachment " - << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL; - inv_items_to_link.push_back(item); - } - } - if (inv_items_to_link.size()) - { - LLPointer cb = new LLRequestServerAppearanceUpdateOnDestroy(); - link_inventory_array(LLAppearanceMgr::instance().getCOF(), inv_items_to_link, cb); - } - mRecentlyArrivedAttachments.clear(); - } -} - -// FIXME this is basically the same code as LLAgentWearables::userAttachMultipleAttachments(), -// should consolidate. +// Send request(s) for a group of attachments. As coded, this can +// request at most 40 attachments and the rest will be +// ignored. Currently the max attachments per avatar is 38, so the 40 +// limit should not be hit in practice. void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_requests) { // Make sure we got a region before trying anything else @@ -184,8 +120,6 @@ void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_re { return; } - LL_DEBUGS("Avatar") << "ATT [RezMultipleAttachmentsFromInv] attaching multiple from attachment_requests," - " total obj_count " << obj_count << LL_ENDL; // Limit number of packets to send const S32 MAX_PACKETS_TO_SEND = 10; @@ -193,9 +127,16 @@ void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_re const S32 MAX_OBJECTS_TO_SEND = MAX_PACKETS_TO_SEND * OBJECTS_PER_PACKET; if( obj_count > MAX_OBJECTS_TO_SEND ) { + LL_WARNS() << "Too many attachments requested: " << attachment_requests.size() + << " exceeds limit of " << MAX_OBJECTS_TO_SEND << LL_ENDL; + LL_WARNS() << "Excess requests will be ignored" << LL_ENDL; + obj_count = MAX_OBJECTS_TO_SEND; } + LL_DEBUGS("Avatar") << "ATT [RezMultipleAttachmentsFromInv] attaching multiple from attachment_requests," + " total obj_count " << obj_count << LL_ENDL; + LLUUID compound_msg_id; compound_msg_id.generate(); LLMessageSystem* msg = gMessageSystem; @@ -249,6 +190,52 @@ void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_re } } +void LLAttachmentsMgr::linkRecentlyArrivedAttachments() +{ + if (mRecentlyArrivedAttachments.size()) + { + // One or more attachments have arrived but have not yet been + // processed for COF links + if (mAttachmentRequests.empty()) + { + // Not waiting for any more. + LL_DEBUGS("Avatar") << "ATT all pending attachments have arrived after " + << mCOFLinkBatchTimer.getElapsedTimeF32() << " seconds" << LL_ENDL; + } + else if (mCOFLinkBatchTimer.getElapsedTimeF32() > COF_LINK_BATCH_TIME) + { + LL_DEBUGS("Avatar") << "ATT " << mAttachmentRequests.size() + << " pending attachments have not arrived, but wait time exceeded" << LL_ENDL; + } + else + { + return; + } + + LL_DEBUGS("Avatar") << "ATT checking COF linkability for " << mRecentlyArrivedAttachments.size() << " recently arrived items" << LL_ENDL; + LLInventoryObject::const_object_list_t inv_items_to_link; + for (std::set::iterator it = mRecentlyArrivedAttachments.begin(); + it != mRecentlyArrivedAttachments.end(); ++it) + { + if (gAgentAvatarp->isWearingAttachment(*it) && + !LLAppearanceMgr::instance().isLinkedInCOF(*it)) + { + LLUUID item_id = *it; + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LL_DEBUGS("Avatar") << "ATT adding COF link for attachment " + << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL; + inv_items_to_link.push_back(item); + } + } + if (inv_items_to_link.size()) + { + LLPointer cb = new LLRequestServerAppearanceUpdateOnDestroy(); + link_inventory_array(LLAppearanceMgr::instance().getCOF(), inv_items_to_link, cb); + } + mRecentlyArrivedAttachments.clear(); + } +} + void LLAttachmentsMgr::addAttachmentRequestTime(const LLUUID& inv_item_id) { LLInventoryItem *item = gInventory.getItem(inv_item_id); @@ -264,17 +251,17 @@ void LLAttachmentsMgr::removeAttachmentRequestTime(const LLUUID& inv_item_id) mAttachmentRequests.erase(inv_item_id); } -BOOL LLAttachmentsMgr::attachmentWasRequestedRecently(const LLUUID& inv_item_id, F32 seconds) const +BOOL LLAttachmentsMgr::attachmentWasRequestedRecently(const LLUUID& inv_item_id) const { std::map::const_iterator it = mAttachmentRequests.find(inv_item_id); if (it != mAttachmentRequests.end()) { const LLTimer& request_time = it->second; F32 request_time_elapsed = request_time.getElapsedTimeF32(); - if (request_time_elapsed > seconds) + if (request_time_elapsed > MIN_RETRY_REQUEST_TIME) { LLInventoryItem *item = gInventory.getItem(inv_item_id); - LL_DEBUGS("Avatar") << "ATT time ignored, exceeded " << seconds + LL_DEBUGS("Avatar") << "ATT time ignored, exceeded " << MIN_RETRY_REQUEST_TIME << " " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; return FALSE; } @@ -289,11 +276,37 @@ BOOL LLAttachmentsMgr::attachmentWasRequestedRecently(const LLUUID& inv_item_id, } } +// If we've been waiting for an attachment a long time, we want to +// forget the request, because if the request is invalid (say the +// object does not exist), the existence of a request that never goes +// away will gum up the COF batch logic, causing it to always wait for +// the timeout. Expiring a request means if the item does show up +// late, the COF link request may not get properly batched up, but +// behavior will be no worse than before we had the batching mechanism +// in place; the COF link will still be created, but extra +// requestServerAppearanceUpdate() calls may occur. +void LLAttachmentsMgr::expireOldAttachmentRequests() +{ + for (std::map::iterator it = mAttachmentRequests.begin(); + it != mAttachmentRequests.end(); ) + { + std::map::iterator curr_it = it; + ++it; + if (it->second.getElapsedTimeF32() > MAX_ATTACHMENT_REQUEST_LIFETIME) + { + mAttachmentRequests.erase(curr_it); + } + } +} + +// When an attachment arrives, we want to stop waiting for it, and add +// it to the set of recently arrived items. void LLAttachmentsMgr::onAttachmentArrived(const LLUUID& inv_item_id) { removeAttachmentRequestTime(inv_item_id); if (mRecentlyArrivedAttachments.empty()) { + // Start the timer for sending off a COF link batch. mCOFLinkBatchTimer.reset(); } mRecentlyArrivedAttachments.insert(inv_item_id); -- cgit v1.2.3 From 779d5ac56e539638d11c80ad6ab5e56b86b0bcb3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 19 Mar 2015 17:38:57 -0400 Subject: MAINT-4917 WIP - debug line added. --- indra/newview/llattachmentsmgr.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index b00ccd2d40..285824f261 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -294,6 +294,8 @@ void LLAttachmentsMgr::expireOldAttachmentRequests() ++it; if (it->second.getElapsedTimeF32() > MAX_ATTACHMENT_REQUEST_LIFETIME) { + LL_DEBUGS("Avatar") << "ATT expiring request for attachment item_id " << curr_it->first + << " after " << MAX_ATTACHMENT_REQUEST_LIFETIME << " seconds" << LL_ENDL; mAttachmentRequests.erase(curr_it); } } -- cgit v1.2.3 From 6fc663d62ad847a6b91029ce9576058cd01a3d68 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 20 Mar 2015 11:03:47 -0400 Subject: DRTVWR-397 WIP - logging for detach requests and unexpected detaches (presumably server-initiated) --- indra/newview/llattachmentsmgr.cpp | 95 +++++++++++++++++++++++++++----------- 1 file changed, 67 insertions(+), 28 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 285824f261..6b8f7044cd 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -40,7 +40,9 @@ const F32 COF_LINK_BATCH_TIME = 5.0F; const F32 MAX_ATTACHMENT_REQUEST_LIFETIME = 30.0F; const F32 MIN_RETRY_REQUEST_TIME = 5.0F; -LLAttachmentsMgr::LLAttachmentsMgr() +LLAttachmentsMgr::LLAttachmentsMgr(): + mAttachmentRequests("attach",MIN_RETRY_REQUEST_TIME), + mDetachRequests("detach",MIN_RETRY_REQUEST_TIME) { } @@ -54,7 +56,7 @@ void LLAttachmentsMgr::addAttachmentRequest(const LLUUID& item_id, { LLViewerInventoryItem *item = gInventory.getItem(item_id); - if (attachmentWasRequestedRecently(item_id)) + if (mAttachmentRequests.wasRequestedRecently(item_id)) { LL_DEBUGS("Avatar") << "ATT not adding attachment to mPendingAttachments, recent request is already pending: " << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; @@ -70,7 +72,7 @@ void LLAttachmentsMgr::addAttachmentRequest(const LLUUID& item_id, attachment.mAdd = add; mPendingAttachments.push_back(attachment); - addAttachmentRequestTime(item_id); + mAttachmentRequests.addTime(item_id); } // static @@ -212,7 +214,8 @@ void LLAttachmentsMgr::linkRecentlyArrivedAttachments() return; } - LL_DEBUGS("Avatar") << "ATT checking COF linkability for " << mRecentlyArrivedAttachments.size() << " recently arrived items" << LL_ENDL; + LL_DEBUGS("Avatar") << "ATT checking COF linkability for " << mRecentlyArrivedAttachments.size() + << " recently arrived items" << LL_ENDL; LLInventoryObject::const_object_list_t inv_items_to_link; for (std::set::iterator it = mRecentlyArrivedAttachments.begin(); it != mRecentlyArrivedAttachments.end(); ++it) @@ -236,44 +239,57 @@ void LLAttachmentsMgr::linkRecentlyArrivedAttachments() } } -void LLAttachmentsMgr::addAttachmentRequestTime(const LLUUID& inv_item_id) +LLAttachmentsMgr::LLItemRequestTimes::LLItemRequestTimes(const std::string& op_name, F32 timeout): + mOpName(op_name), + mTimeout(timeout) +{ +} + +void LLAttachmentsMgr::LLItemRequestTimes::addTime(const LLUUID& inv_item_id) { LLInventoryItem *item = gInventory.getItem(inv_item_id); - LL_DEBUGS("Avatar") << "ATT add request time " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; + LL_DEBUGS("Avatar") << "ATT " << mOpName << " adding request time " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; LLTimer current_time; - mAttachmentRequests[inv_item_id] = current_time; + (*this)[inv_item_id] = current_time; } -void LLAttachmentsMgr::removeAttachmentRequestTime(const LLUUID& inv_item_id) +void LLAttachmentsMgr::LLItemRequestTimes::removeTime(const LLUUID& inv_item_id) { LLInventoryItem *item = gInventory.getItem(inv_item_id); - LL_DEBUGS("Avatar") << "ATT remove request time " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; - mAttachmentRequests.erase(inv_item_id); + LL_DEBUGS("Avatar") << "ATT " << mOpName << " removing request time " + << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; + (*this).erase(inv_item_id); } -BOOL LLAttachmentsMgr::attachmentWasRequestedRecently(const LLUUID& inv_item_id) const +BOOL LLAttachmentsMgr::LLItemRequestTimes::getTime(const LLUUID& inv_item_id, LLTimer& timer) const { - std::map::const_iterator it = mAttachmentRequests.find(inv_item_id); - if (it != mAttachmentRequests.end()) + std::map::const_iterator it = (*this).find(inv_item_id); + if (it != (*this).end()) { - const LLTimer& request_time = it->second; + timer = it->second; + return TRUE; + } + return FALSE; +} + +BOOL LLAttachmentsMgr::LLItemRequestTimes::wasRequestedRecently(const LLUUID& inv_item_id) const +{ + LLTimer request_time; + if (getTime(inv_item_id, request_time)) + { F32 request_time_elapsed = request_time.getElapsedTimeF32(); - if (request_time_elapsed > MIN_RETRY_REQUEST_TIME) + if (request_time_elapsed >= mTimeout) { LLInventoryItem *item = gInventory.getItem(inv_item_id); - LL_DEBUGS("Avatar") << "ATT time ignored, exceeded " << MIN_RETRY_REQUEST_TIME + LL_DEBUGS("Avatar") << "ATT " << mOpName << " request time ignored, exceeded " << mTimeout << " " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; - return FALSE; - } - else - { - return TRUE; - } - } - else - { - return FALSE; - } + } + return request_time_elapsed < mTimeout; + } + else + { + return FALSE; + } } // If we've been waiting for an attachment a long time, we want to @@ -305,7 +321,7 @@ void LLAttachmentsMgr::expireOldAttachmentRequests() // it to the set of recently arrived items. void LLAttachmentsMgr::onAttachmentArrived(const LLUUID& inv_item_id) { - removeAttachmentRequestTime(inv_item_id); + mAttachmentRequests.removeTime(inv_item_id); if (mRecentlyArrivedAttachments.empty()) { // Start the timer for sending off a COF link batch. @@ -313,3 +329,26 @@ void LLAttachmentsMgr::onAttachmentArrived(const LLUUID& inv_item_id) } mRecentlyArrivedAttachments.insert(inv_item_id); } + +void LLAttachmentsMgr::onDetachRequested(const LLUUID& inv_item_id) +{ + mDetachRequests.addTime(inv_item_id); +} + +void LLAttachmentsMgr::onDetachCompleted(const LLUUID& inv_item_id) +{ + LLTimer timer; + LLInventoryItem *item = gInventory.getItem(inv_item_id); + if (mDetachRequests.getTime(inv_item_id, timer)) + { + LL_DEBUGS("Avatar") << "ATT detach completed after " << timer.getElapsedTimeF32() + << " seconds for " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; + mDetachRequests.removeTime(inv_item_id); + } + else + { + LL_WARNS("Avatar") << "ATT unexpected detach for " + << (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL; + } + +} -- cgit v1.2.3 From 81f9c81fe7caa8fceff4438a4c4b99f975c4f0de Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 20 Mar 2015 11:27:47 -0400 Subject: DRTVWR-397 WIP - ATT logging --- indra/newview/llattachmentsmgr.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 6b8f7044cd..fa2d95a1e6 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -129,9 +129,9 @@ void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_re const S32 MAX_OBJECTS_TO_SEND = MAX_PACKETS_TO_SEND * OBJECTS_PER_PACKET; if( obj_count > MAX_OBJECTS_TO_SEND ) { - LL_WARNS() << "Too many attachments requested: " << attachment_requests.size() + LL_WARNS() << "ATT Too many attachments requested: " << attachment_requests.size() << " exceeds limit of " << MAX_OBJECTS_TO_SEND << LL_ENDL; - LL_WARNS() << "Excess requests will be ignored" << LL_ENDL; + LL_WARNS() << "ATT Excess requests will be ignored" << LL_ENDL; obj_count = MAX_OBJECTS_TO_SEND; } @@ -310,7 +310,9 @@ void LLAttachmentsMgr::expireOldAttachmentRequests() ++it; if (it->second.getElapsedTimeF32() > MAX_ATTACHMENT_REQUEST_LIFETIME) { - LL_DEBUGS("Avatar") << "ATT expiring request for attachment item_id " << curr_it->first + LLInventoryItem *item = gInventory.getItem(curr_it->first); + LL_DEBUGS("Avatar") << "ATT expiring request for attachment " + << (item ? item->getName() : "UNKNOWN") << "item_id " << curr_it->first << " after " << MAX_ATTACHMENT_REQUEST_LIFETIME << " seconds" << LL_ENDL; mAttachmentRequests.erase(curr_it); } @@ -321,6 +323,13 @@ void LLAttachmentsMgr::expireOldAttachmentRequests() // it to the set of recently arrived items. void LLAttachmentsMgr::onAttachmentArrived(const LLUUID& inv_item_id) { + LLTimer timer; + if (!mAttachmentRequests.getTime(inv_item_id, timer)) + { + LLInventoryItem *item = gInventory.getItem(inv_item_id); + LL_WARNS() << "ATT Attachment was unexpected or arrived after " << MAX_ATTACHMENT_REQUEST_LIFETIME << " seconds: " + << (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL; + } mAttachmentRequests.removeTime(inv_item_id); if (mRecentlyArrivedAttachments.empty()) { @@ -347,8 +356,7 @@ void LLAttachmentsMgr::onDetachCompleted(const LLUUID& inv_item_id) } else { - LL_WARNS("Avatar") << "ATT unexpected detach for " - << (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL; + LL_WARNS() << "ATT unexpected detach for " + << (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL; } - } -- cgit v1.2.3 From b40bdb266a2525517ca509ca05c89ac4e46dc367 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 31 Mar 2015 14:18:49 -0400 Subject: DRTVWR-397 WIP - logging updates and fixes --- indra/newview/llattachmentsmgr.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index fa2d95a1e6..ae9560211f 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -94,6 +94,8 @@ void LLAttachmentsMgr::onIdle() linkRecentlyArrivedAttachments(); expireOldAttachmentRequests(); + + expireOldDetachRequests(); } void LLAttachmentsMgr::requestPendingAttachments() @@ -308,17 +310,35 @@ void LLAttachmentsMgr::expireOldAttachmentRequests() { std::map::iterator curr_it = it; ++it; - if (it->second.getElapsedTimeF32() > MAX_ATTACHMENT_REQUEST_LIFETIME) + if (curr_it->second.getElapsedTimeF32() > MAX_ATTACHMENT_REQUEST_LIFETIME) { LLInventoryItem *item = gInventory.getItem(curr_it->first); LL_DEBUGS("Avatar") << "ATT expiring request for attachment " - << (item ? item->getName() : "UNKNOWN") << "item_id " << curr_it->first + << (item ? item->getName() : "UNKNOWN") << " item_id " << curr_it->first << " after " << MAX_ATTACHMENT_REQUEST_LIFETIME << " seconds" << LL_ENDL; mAttachmentRequests.erase(curr_it); } } } +void LLAttachmentsMgr::expireOldDetachRequests() +{ + for (std::map::iterator it = mDetachRequests.begin(); + it != mDetachRequests.end(); ) + { + std::map::iterator curr_it = it; + ++it; + if (curr_it->second.getElapsedTimeF32() > MAX_ATTACHMENT_REQUEST_LIFETIME) + { + LLInventoryItem *item = gInventory.getItem(curr_it->first); + LL_DEBUGS("Avatar") << "ATT expiring request for detach " + << (item ? item->getName() : "UNKNOWN") << " item_id " << curr_it->first + << " after " << MAX_ATTACHMENT_REQUEST_LIFETIME << " seconds" << LL_ENDL; + mDetachRequests.erase(curr_it); + } + } +} + // When an attachment arrives, we want to stop waiting for it, and add // it to the set of recently arrived items. void LLAttachmentsMgr::onAttachmentArrived(const LLUUID& inv_item_id) -- cgit v1.2.3 From f1684cdea5e1086b1127993eac9a5a7b4e47321a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 2 Apr 2015 17:47:22 -0400 Subject: DRTVWR-397 WIP - more logging --- indra/newview/llattachmentsmgr.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index ae9560211f..50f5efca25 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -258,9 +258,12 @@ void LLAttachmentsMgr::LLItemRequestTimes::addTime(const LLUUID& inv_item_id) void LLAttachmentsMgr::LLItemRequestTimes::removeTime(const LLUUID& inv_item_id) { LLInventoryItem *item = gInventory.getItem(inv_item_id); - LL_DEBUGS("Avatar") << "ATT " << mOpName << " removing request time " - << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; - (*this).erase(inv_item_id); + S32 remove_count = (*this).erase(inv_item_id); + if (remove_count) + { + LL_DEBUGS("Avatar") << "ATT " << mOpName << " removing request time " + << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; + } } BOOL LLAttachmentsMgr::LLItemRequestTimes::getTime(const LLUUID& inv_item_id, LLTimer& timer) const @@ -313,7 +316,7 @@ void LLAttachmentsMgr::expireOldAttachmentRequests() if (curr_it->second.getElapsedTimeF32() > MAX_ATTACHMENT_REQUEST_LIFETIME) { LLInventoryItem *item = gInventory.getItem(curr_it->first); - LL_DEBUGS("Avatar") << "ATT expiring request for attachment " + LL_WARNS("Avatar") << "ATT expiring request for attachment " << (item ? item->getName() : "UNKNOWN") << " item_id " << curr_it->first << " after " << MAX_ATTACHMENT_REQUEST_LIFETIME << " seconds" << LL_ENDL; mAttachmentRequests.erase(curr_it); @@ -331,7 +334,7 @@ void LLAttachmentsMgr::expireOldDetachRequests() if (curr_it->second.getElapsedTimeF32() > MAX_ATTACHMENT_REQUEST_LIFETIME) { LLInventoryItem *item = gInventory.getItem(curr_it->first); - LL_DEBUGS("Avatar") << "ATT expiring request for detach " + LL_WARNS("Avatar") << "ATT expiring request for detach " << (item ? item->getName() : "UNKNOWN") << " item_id " << curr_it->first << " after " << MAX_ATTACHMENT_REQUEST_LIFETIME << " seconds" << LL_ENDL; mDetachRequests.erase(curr_it); @@ -344,13 +347,19 @@ void LLAttachmentsMgr::expireOldDetachRequests() void LLAttachmentsMgr::onAttachmentArrived(const LLUUID& inv_item_id) { LLTimer timer; - if (!mAttachmentRequests.getTime(inv_item_id, timer)) + bool expected = mAttachmentRequests.getTime(inv_item_id, timer); + if (!expected) { LLInventoryItem *item = gInventory.getItem(inv_item_id); LL_WARNS() << "ATT Attachment was unexpected or arrived after " << MAX_ATTACHMENT_REQUEST_LIFETIME << " seconds: " << (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL; } mAttachmentRequests.removeTime(inv_item_id); + if (expected && mAttachmentRequests.empty()) + { + // mAttachmentRequests just emptied out + LL_DEBUGS("Avatar") << "ATT all active attachment requests have completed" << LL_ENDL; + } if (mRecentlyArrivedAttachments.empty()) { // Start the timer for sending off a COF link batch. @@ -373,6 +382,10 @@ void LLAttachmentsMgr::onDetachCompleted(const LLUUID& inv_item_id) LL_DEBUGS("Avatar") << "ATT detach completed after " << timer.getElapsedTimeF32() << " seconds for " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; mDetachRequests.removeTime(inv_item_id); + if (mDetachRequests.empty()) + { + LL_DEBUGS("Avatar") << "ATT all detach requests have completed" << LL_ENDL; + } } else { -- cgit v1.2.3 From 6ac9852d54d1ee4f826a08ca73f08bccf403d8c3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 9 Apr 2015 13:29:39 -0400 Subject: MAINT-5069 WIP, MAINT-5071 WIP - handle dropping objects and attaching from ground. WIP on better tracking of attachment requests via various message in LLSelectMgr. --- indra/newview/llattachmentsmgr.cpp | 53 +++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 50f5efca25..c9733d43b6 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -75,6 +75,14 @@ void LLAttachmentsMgr::addAttachmentRequest(const LLUUID& item_id, mAttachmentRequests.addTime(item_id); } +void LLAttachmentsMgr::onAttachmentRequested(const LLUUID& item_id) +{ + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LL_DEBUGS("Avatar") << "ATT attachment was requested " + << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; + mAttachmentRequests.addTime(item_id); +} + // static void LLAttachmentsMgr::onIdle(void *) { @@ -96,6 +104,8 @@ void LLAttachmentsMgr::onIdle() expireOldAttachmentRequests(); expireOldDetachRequests(); + + spamStatusInfo(); } void LLAttachmentsMgr::requestPendingAttachments() @@ -218,7 +228,8 @@ void LLAttachmentsMgr::linkRecentlyArrivedAttachments() LL_DEBUGS("Avatar") << "ATT checking COF linkability for " << mRecentlyArrivedAttachments.size() << " recently arrived items" << LL_ENDL; - LLInventoryObject::const_object_list_t inv_items_to_link; + + uuid_vec_t ids_to_link; for (std::set::iterator it = mRecentlyArrivedAttachments.begin(); it != mRecentlyArrivedAttachments.end(); ++it) { @@ -229,13 +240,17 @@ void LLAttachmentsMgr::linkRecentlyArrivedAttachments() LLViewerInventoryItem *item = gInventory.getItem(item_id); LL_DEBUGS("Avatar") << "ATT adding COF link for attachment " << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL; - inv_items_to_link.push_back(item); + ids_to_link.push_back(item_id); } } - if (inv_items_to_link.size()) + if (ids_to_link.size()) { LLPointer cb = new LLRequestServerAppearanceUpdateOnDestroy(); - link_inventory_array(LLAppearanceMgr::instance().getCOF(), inv_items_to_link, cb); + for (uuid_vec_t::const_iterator uuid_it = ids_to_link.begin(); + uuid_it != ids_to_link.end(); ++uuid_it) + { + LLAppearanceMgr::instance().addCOFItemLink(*uuid_it, cb); + } } mRecentlyArrivedAttachments.clear(); } @@ -393,3 +408,33 @@ void LLAttachmentsMgr::onDetachCompleted(const LLUUID& inv_item_id) << (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL; } } + +void LLAttachmentsMgr::spamStatusInfo() +{ +#if 0 + static LLTimer spam_timer; + const F32 spam_frequency = 100.0F; + + if (spam_timer.getElapsedTimeF32() > spam_frequency) + { + spam_timer.reset(); + + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(), + cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH); + for (S32 i=0; igetType() == LLAssetType::AT_OBJECT) + { + LL_DEBUGS("Avatar") << "item_id: " << inv_item->getUUID() + << " linked_item_id: " << inv_item->getLinkedUUID() + << " name: " << inv_item->getName() + << " parent: " << inv_item->getParentUUID() + << LL_ENDL; + } + } + } +#endif +} -- cgit v1.2.3 From 0e0339914f094a5f92eb1a2b8736979a848214e9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 10 Apr 2015 16:13:51 -0400 Subject: MAINT-5070 WIP, MAINT-4409 WIP - try to clean up invalid COF links under certain circumstances. --- indra/newview/llattachmentsmgr.cpp | 88 ++++++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 8 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index c9733d43b6..bbfcb6b955 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -39,10 +39,12 @@ const F32 COF_LINK_BATCH_TIME = 5.0F; const F32 MAX_ATTACHMENT_REQUEST_LIFETIME = 30.0F; const F32 MIN_RETRY_REQUEST_TIME = 5.0F; +const F32 MAX_BAD_COF_TIME = 30.0F; LLAttachmentsMgr::LLAttachmentsMgr(): mAttachmentRequests("attach",MIN_RETRY_REQUEST_TIME), - mDetachRequests("detach",MIN_RETRY_REQUEST_TIME) + mDetachRequests("detach",MIN_RETRY_REQUEST_TIME), + mQuestionableCOFLinks("badcof",MAX_BAD_COF_TIME) { } @@ -105,6 +107,8 @@ void LLAttachmentsMgr::onIdle() expireOldDetachRequests(); + checkInvalidCOFLinks(); + spamStatusInfo(); } @@ -233,7 +237,8 @@ void LLAttachmentsMgr::linkRecentlyArrivedAttachments() for (std::set::iterator it = mRecentlyArrivedAttachments.begin(); it != mRecentlyArrivedAttachments.end(); ++it) { - if (gAgentAvatarp->isWearingAttachment(*it) && + if (isAgentAvatarValid() && + gAgentAvatarp->isWearingAttachment(*it) && !LLAppearanceMgr::instance().isLinkedInCOF(*it)) { LLUUID item_id = *it; @@ -298,12 +303,6 @@ BOOL LLAttachmentsMgr::LLItemRequestTimes::wasRequestedRecently(const LLUUID& in if (getTime(inv_item_id, request_time)) { F32 request_time_elapsed = request_time.getElapsedTimeF32(); - if (request_time_elapsed >= mTimeout) - { - LLInventoryItem *item = gInventory.getItem(inv_item_id); - LL_DEBUGS("Avatar") << "ATT " << mOpName << " request time ignored, exceeded " << mTimeout - << " " << (item ? item->getName() : "UNKNOWN") << " " << inv_item_id << LL_ENDL; - } return request_time_elapsed < mTimeout; } else @@ -407,6 +406,79 @@ void LLAttachmentsMgr::onDetachCompleted(const LLUUID& inv_item_id) LL_WARNS() << "ATT unexpected detach for " << (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL; } + + LL_DEBUGS("Avatar") << "ATT detached item flagging as questionable for COF link checking " + << (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL; + mQuestionableCOFLinks.addTime(inv_item_id); +} + +// Check for attachments that are (a) linked in COF and (b) not +// attached to the avatar. This is a rotten function to have to +// include, because it runs the risk of either repeatedly spamming out +// COF link removals if they're failing for some reason, or getting +// into a tug of war with some other sequence of events that's in the +// process of adding the attachment in question. However, it's needed +// because we have no definitive source of authority for what things +// are actually supposed to be attached. Scripts, run on the server +// side, can remove an attachment without our expecting it. If this +// happens to an attachment that's just been added, then the COF link +// creation may still be in flight, and we will have to delete the +// link after it shows up. +// +// Note that we only flag items for possible link removal if they have +// been previously detached. This means that an attachment failure +// will leave the link in the COF, where it will hopefully resolve +// correctly on relog. +// +// See related: MAINT-5070, MAINT-4409 +// +void LLAttachmentsMgr::checkInvalidCOFLinks() +{ + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(), + cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH); + for (S32 i=0; igetLinkedUUID(); + if (inv_item->getType() == LLAssetType::AT_OBJECT) + { + LLTimer timer; + bool is_flagged_questionable = mQuestionableCOFLinks.getTime(item_id,timer); + bool is_wearing_attachment = isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item_id); + if (is_wearing_attachment && is_flagged_questionable) + { + LL_DEBUGS("Avatar") << "ATT was flagged questionable but is now " + << (is_wearing_attachment ? "attached " : "") + <<"removing flag after " + << timer.getElapsedTimeF32() << " item " + << inv_item->getName() << " id " << item_id << LL_ENDL; + mQuestionableCOFLinks.removeTime(item_id); + } + } + } + + for(LLItemRequestTimes::iterator it = mQuestionableCOFLinks.begin(); + it != mQuestionableCOFLinks.end(); ) + { + LLItemRequestTimes::iterator curr_it = it; + ++it; + const LLUUID& item_id = curr_it->first; + LLViewerInventoryItem *inv_item = gInventory.getItem(item_id); + if (curr_it->second.getElapsedTimeF32() > MAX_BAD_COF_TIME) + { + if (LLAppearanceMgr::instance().isLinkedInCOF(item_id)) + { + LL_DEBUGS("Avatar") << "ATT Linked in COF but not attached or requested, deleting link after " + << curr_it->second.getElapsedTimeF32() << " seconds for " + << (inv_item ? inv_item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; + LLAppearanceMgr::instance().removeCOFItemLinks(item_id); + } + mQuestionableCOFLinks.erase(curr_it); + continue; + } + } } void LLAttachmentsMgr::spamStatusInfo() -- cgit v1.2.3 From 4d689fc5155458f71912ff11c869d1b2e2e3076e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 22 Apr 2015 16:09:02 -0400 Subject: MAINT-4653 WIP, DRTVWR-397 WIP - log output to file now includes tags. Request max 5 attachments per idle loop to reduce sim-side failures seen when requesting large numbers. --- indra/newview/llattachmentsmgr.cpp | 56 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index bbfcb6b955..39c21a195a 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -117,7 +117,6 @@ void LLAttachmentsMgr::requestPendingAttachments() if (mPendingAttachments.size()) { requestAttachments(mPendingAttachments); - mPendingAttachments.clear(); } } @@ -125,7 +124,7 @@ void LLAttachmentsMgr::requestPendingAttachments() // request at most 40 attachments and the rest will be // ignored. Currently the max attachments per avatar is 38, so the 40 // limit should not be hit in practice. -void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_requests) +void LLAttachmentsMgr::requestAttachments(attachments_vec_t& attachment_requests) { // Make sure we got a region before trying anything else if( !gAgent.getRegion() ) @@ -133,7 +132,8 @@ void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_re return; } - S32 obj_count = attachment_requests.size(); + const S32 max_objects_per_request = 5; + S32 obj_count = llmin((S32)attachment_requests.size(),max_objects_per_request); if (obj_count == 0) { return; @@ -145,7 +145,7 @@ void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_re const S32 MAX_OBJECTS_TO_SEND = MAX_PACKETS_TO_SEND * OBJECTS_PER_PACKET; if( obj_count > MAX_OBJECTS_TO_SEND ) { - LL_WARNS() << "ATT Too many attachments requested: " << attachment_requests.size() + LL_WARNS() << "ATT Too many attachments requested: " << obj_count << " exceeds limit of " << MAX_OBJECTS_TO_SEND << LL_ENDL; LL_WARNS() << "ATT Excess requests will be ignored" << LL_ENDL; @@ -159,12 +159,10 @@ void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_re compound_msg_id.generate(); LLMessageSystem* msg = gMessageSystem; - - S32 i = 0; - for (attachments_vec_t::const_iterator iter = attachment_requests.begin(); - iter != attachment_requests.end(); - ++iter) - { + // by construction, obj_count <= attachment_requests.size(), so no + // check against empty() is needed here. + for (S32 i=0; iaddBOOLFast(_PREHASH_FirstDetachAll, false ); } - const AttachmentsInfo &attachment = (*iter); + const AttachmentsInfo& attachment = attachment_requests.front(); LLViewerInventoryItem* item = gInventory.getItem(attachment.mItemID); - if (!item) + if (item) + { + LL_DEBUGS("Avatar") << "ATT requesting from attachment_requests " << item->getName() + << " " << item->getLinkedUUID() << LL_ENDL; + S32 attachment_pt = attachment.mAttachmentPt; + if (attachment.mAdd) + attachment_pt |= ATTACHMENT_ADD; + + msg->nextBlockFast(_PREHASH_ObjectData ); + msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID()); + msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner()); + msg->addU8Fast(_PREHASH_AttachmentPt, attachment_pt); + pack_permissions_slam(msg, item->getFlags(), item->getPermissions()); + msg->addStringFast(_PREHASH_Name, item->getName()); + msg->addStringFast(_PREHASH_Description, item->getDescription()); + } + else { - LL_INFOS() << "Attempted to add non-existent item ID:" << attachment.mItemID << LL_ENDL; - continue; + LL_INFOS("Avatar") << "ATT Attempted to add non-existent item ID:" << attachment.mItemID << LL_ENDL; } - LL_DEBUGS("Avatar") << "ATT requesting from attachment_requests " << item->getName() - << " " << item->getLinkedUUID() << LL_ENDL; - S32 attachment_pt = attachment.mAttachmentPt; - if (attachment.mAdd) - attachment_pt |= ATTACHMENT_ADD; - - msg->nextBlockFast(_PREHASH_ObjectData ); - msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID()); - msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner()); - msg->addU8Fast(_PREHASH_AttachmentPt, attachment_pt); - pack_permissions_slam(msg, item->getFlags(), item->getPermissions()); - msg->addStringFast(_PREHASH_Name, item->getName()); - msg->addStringFast(_PREHASH_Description, item->getDescription()); if( (i+1 == obj_count) || ((OBJECTS_PER_PACKET-1) == (i % OBJECTS_PER_PACKET)) ) { // End of message chunk msg->sendReliable( gAgent.getRegion()->getHost() ); } - i++; + attachment_requests.pop_front(); } } -- cgit v1.2.3 From ff42e557848158d5a01cc260bac0bbf974650934 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 24 Apr 2015 10:06:30 -0400 Subject: DRTVWR-397 WIP - comments and logging --- indra/newview/llattachmentsmgr.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 39c21a195a..799a25ddc9 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -132,6 +132,9 @@ void LLAttachmentsMgr::requestAttachments(attachments_vec_t& attachment_requests return; } + // For unknown reasons, requesting many attachments at once causes + // frequent server-side failures. Here we're limiting the number + // of attachments requested per idle loop. const S32 max_objects_per_request = 5; S32 obj_count = llmin((S32)attachment_requests.size(),max_objects_per_request); if (obj_count == 0) @@ -147,7 +150,6 @@ void LLAttachmentsMgr::requestAttachments(attachments_vec_t& attachment_requests { LL_WARNS() << "ATT Too many attachments requested: " << obj_count << " exceeds limit of " << MAX_OBJECTS_TO_SEND << LL_ENDL; - LL_WARNS() << "ATT Excess requests will be ignored" << LL_ENDL; obj_count = MAX_OBJECTS_TO_SEND; } @@ -159,8 +161,10 @@ void LLAttachmentsMgr::requestAttachments(attachments_vec_t& attachment_requests compound_msg_id.generate(); LLMessageSystem* msg = gMessageSystem; - // by construction, obj_count <= attachment_requests.size(), so no - // check against empty() is needed here. + // by construction above, obj_count <= attachment_requests.size(), so no + // check against attachment_requests.empty() is needed. + llassert(obj_count <= attachment_requests.size()); + for (S32 i=0; i Date: Mon, 18 May 2015 13:10:26 -0400 Subject: MAINT-5222 WIP - checks for app shutting down a couple of places. --- indra/newview/llattachmentsmgr.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llattachmentsmgr.cpp') diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 799a25ddc9..2a137cc39b 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -99,6 +99,11 @@ void LLAttachmentsMgr::onIdle() return; } + if (LLApp::isExiting()) + { + return; + } + requestPendingAttachments(); linkRecentlyArrivedAttachments(); -- cgit v1.2.3