Skip to content

#3413 Shutdown crash at removeFromLocalIDTable #3414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions indra/newview/llviewerobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,9 @@ class LLViewerObject
// index into LLViewerObjectList::mActiveObjects or -1 if not in list
S32 mListIndex;

// last index data for mIndexAndLocalIDToUUID
U32 mRegionIndex;

LLPointer<LLViewerTexture> *mTEImages;
LLPointer<LLViewerTexture> *mTENormalMaps;
LLPointer<LLViewerTexture> *mTESpecularMaps;
Expand Down
59 changes: 28 additions & 31 deletions indra/newview/llviewerobjectlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,21 +164,14 @@ U64 LLViewerObjectList::getIndex(const U32 local_id,
return (((U64)index) << 32) | (U64)local_id;
}

bool LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp)
bool LLViewerObjectList::removeFromLocalIDTable(LLViewerObject* objectp)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;

if(objectp && objectp->getRegion())
if(objectp && objectp->mRegionIndex != 0)
{
U32 local_id = objectp->mLocalID;
U32 ip = objectp->getRegion()->getHost().getAddress();
U32 port = objectp->getRegion()->getHost().getPort();
U64 ipport = (((U64)ip) << 32) | (U64)port;
U32 index = mIPAndPortToIndex[ipport];

// LL_INFOS() << "Removing object from table, local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL;

U64 indexid = (((U64)index) << 32) | (U64)local_id;
U64 indexid = (((U64)objectp->mRegionIndex) << 32) | (U64)local_id;

std::map<U64, LLUUID>::iterator iter = mIndexAndLocalIDToUUID.find(indexid);
if (iter == mIndexAndLocalIDToUUID.end())
Expand All @@ -190,6 +183,7 @@ bool LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp)
if (iter->second == objectp->getID())
{ // Full UUIDs match, so remove the entry
mIndexAndLocalIDToUUID.erase(iter);
objectp->mRegionIndex = 0;
return true;
}
// UUIDs did not match - this would zap a valid entry, so don't erase it
Expand All @@ -203,7 +197,8 @@ bool LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp)
void LLViewerObjectList::setUUIDAndLocal(const LLUUID &id,
const U32 local_id,
const U32 ip,
const U32 port)
const U32 port,
LLViewerObject* objectp)
{
U64 ipport = (((U64)ip) << 32) | (U64)port;

Expand All @@ -215,6 +210,7 @@ void LLViewerObjectList::setUUIDAndLocal(const LLUUID &id,
mIPAndPortToIndex[ipport] = index;
}

objectp->mRegionIndex = index; // should never be zero, sSimulatorMachineIndex starts from 1
U64 indexid = (((U64)index) << 32) | (U64)local_id;

mIndexAndLocalIDToUUID[indexid] = id;
Expand Down Expand Up @@ -335,7 +331,8 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry*
removeFromLocalIDTable(objectp);
setUUIDAndLocal(fullid, entry->getLocalID(),
regionp->getHost().getAddress(),
regionp->getHost().getPort());
regionp->getHost().getPort(),
objectp);

if (objectp->mLocalID != entry->getLocalID())
{ // Update local ID in object with the one sent from the region
Expand Down Expand Up @@ -582,7 +579,8 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
setUUIDAndLocal(fullid,
local_id,
gMessageSystem->getSenderIP(),
gMessageSystem->getSenderPort());
gMessageSystem->getSenderPort(),
objectp);

if (objectp->mLocalID != local_id)
{ // Update local ID in object with the one sent from the region
Expand Down Expand Up @@ -1381,11 +1379,20 @@ void LLViewerObjectList::killObjects(LLViewerRegion *regionp)
void LLViewerObjectList::killAllObjects()
{
// Used only on global destruction.
LLViewerObject *objectp;

// Mass cleanup to not clear lists one item at a time
mIndexAndLocalIDToUUID.clear();
mActiveObjects.clear();
mMapObjects.clear();

LLViewerObject *objectp;
for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
{
objectp = *iter;
objectp->setOnActiveList(false);
objectp->setListIndex(-1);
objectp->mRegionIndex = 0;
objectp->mOnMap = false;
killObject(objectp);
// Object must be dead, or it's the LLVOAvatarSelf which never dies.
llassert((objectp == gAgentAvatarp) || objectp->isDead());
Expand All @@ -1398,18 +1405,6 @@ void LLViewerObjectList::killAllObjects()
LL_WARNS() << "LLViewerObjectList::killAllObjects still has entries in mObjects: " << mObjects.size() << LL_ENDL;
mObjects.clear();
}

if (!mActiveObjects.empty())
{
LL_WARNS() << "Some objects still on active object list!" << LL_ENDL;
mActiveObjects.clear();
}

if (!mMapObjects.empty())
{
LL_WARNS() << "Some objects still on map object list!" << LL_ENDL;
mMapObjects.clear();
}
}

void LLViewerObjectList::cleanDeadObjects(bool use_timer)
Expand Down Expand Up @@ -1509,9 +1504,9 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp)
mActiveObjects.push_back(objectp);
objectp->setListIndex(static_cast<S32>(mActiveObjects.size()) - 1);
objectp->setOnActiveList(true);
}
else
{
}
else
{
llassert(idx < mActiveObjects.size());
llassert(mActiveObjects[idx] == objectp);

Expand Down Expand Up @@ -1863,7 +1858,8 @@ LLViewerObject *LLViewerObjectList::createObjectFromCache(const LLPCode pcode, L
setUUIDAndLocal(uuid,
local_id,
regionp->getHost().getAddress(),
regionp->getHost().getPort());
regionp->getHost().getPort(),
objectp);
mObjects.push_back(objectp);

updateActive(objectp);
Expand Down Expand Up @@ -1901,7 +1897,8 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe
setUUIDAndLocal(fullid,
local_id,
gMessageSystem->getSenderIP(),
gMessageSystem->getSenderPort());
gMessageSystem->getSenderPort(),
objectp);

mObjects.push_back(objectp);

Expand Down
5 changes: 3 additions & 2 deletions indra/newview/llviewerobjectlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ class LLViewerObjectList
void setUUIDAndLocal(const LLUUID &id,
const U32 local_id,
const U32 ip,
const U32 port); // Requires knowledge of message system info!
const U32 port,
LLViewerObject* objectp); // Requires knowledge of message system info!

bool removeFromLocalIDTable(const LLViewerObject* objectp);
bool removeFromLocalIDTable(LLViewerObject* objectp);
// Used ONLY by the orphaned object code.
U64 getIndex(const U32 local_id, const U32 ip, const U32 port);

Expand Down
Loading