diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llmeshrepository.cpp | 33 | ||||
| -rw-r--r-- | indra/newview/llviewerobject.cpp | 22 | 
2 files changed, 37 insertions, 18 deletions
| diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 71a161198a..bb64201fef 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -903,6 +903,7 @@ void LLMeshRepoThread::run()  			LLMeshRepository::sLODProcessing--;  			mMutex->unlock(); +			// Todo: this and other cases shouldn't retry indefinitely, at the very least do as with mDecompositionRequests  			if (!fetchMeshLOD(req.mMeshParams, req.mLOD))		// failed, resubmit  			{  				mMutex->lock(); @@ -1234,16 +1235,16 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id)  			//check VFS for mesh skin info  			LLVFile file(gVFS, mesh_id, LLAssetType::AT_MESH);  			if (file.getSize() >= offset+size) -			{				 -				LLMeshRepository::sCacheBytesRead += size; -				++LLMeshRepository::sCacheReads; -				file.seek(offset); +			{  				U8* buffer = new(std::nothrow) U8[size];  				if (!buffer)  				{ -					LL_WARNS(LOG_MESH) << "Failed to allocate memory for skin info" << LL_ENDL; +					LL_WARNS_ONCE(LOG_MESH) << "Failed to allocate memory for skin info, size: " << size << LL_ENDL;  					return false;  				} +				LLMeshRepository::sCacheBytesRead += size; +				++LLMeshRepository::sCacheReads; +				file.seek(offset);  				file.read(buffer, size);  				//make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written) @@ -1331,16 +1332,16 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)  			LLVFile file(gVFS, mesh_id, LLAssetType::AT_MESH);  			if (file.getSize() >= offset+size)  			{ -				LLMeshRepository::sCacheBytesRead += size; -				++LLMeshRepository::sCacheReads; - -				file.seek(offset);  				U8* buffer = new(std::nothrow) U8[size];  				if (!buffer)  				{ -					LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition" << LL_ENDL; +					LL_WARNS_ONCE(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL;  					return false;  				} +				LLMeshRepository::sCacheBytesRead += size; +				++LLMeshRepository::sCacheReads; + +				file.seek(offset);  				file.read(buffer, size);  				//make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written) @@ -1434,7 +1435,7 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)  				U8* buffer = new(std::nothrow) U8[size];  				if (!buffer)  				{ -					LL_WARNS(LOG_MESH) << "Failed to allocate memory for physics shape" << LL_ENDL; +					LL_WARNS_ONCE(LOG_MESH) << "Failed to allocate memory for physics shape, size: " << size << LL_ENDL;  					return false;  				}  				file.read(buffer, size); @@ -1612,15 +1613,17 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod)  			LLVFile file(gVFS, mesh_id, LLAssetType::AT_MESH);  			if (file.getSize() >= offset+size)  			{ -				LLMeshRepository::sCacheBytesRead += size; -				++LLMeshRepository::sCacheReads; -				file.seek(offset);  				U8* buffer = new(std::nothrow) U8[size];  				if (!buffer)  				{ -					LL_WARNS(LOG_MESH) << "Can't allocate memory for mesh LOD" << LL_ENDL; +					LL_WARNS_ONCE(LOG_MESH) << "Can't allocate memory for mesh LOD, size: " << size << LL_ENDL; +					// todo: for now it will result in indefinite constant retries, should result in timeout +					// or in retry-count and disabling mesh. (but usually viewer is beyond saving at this point)  					return false;  				} +				LLMeshRepository::sCacheBytesRead += size; +				++LLMeshRepository::sCacheReads; +				file.seek(offset);  				file.read(buffer, size);  				//make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 624c48e945..714bf2c9a0 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -134,6 +134,7 @@ std::map<std::string, U32> LLViewerObject::sObjectDataMap;  // JC 3/18/2003  const F32 PHYSICS_TIMESTEP = 1.f / 45.f; +const U32 MAX_INV_FILE_READ_FAILS = 25;  static LLTrace::BlockTimerStatHandle FTM_CREATE_OBJECT("Create Object"); @@ -3063,6 +3064,7 @@ BOOL LLViewerObject::loadTaskInvFile(const std::string& filename)  	llifstream ifs(filename_and_local_path.c_str());  	if(ifs.good())  	{ +		U32 fail_count = 0;  		char buffer[MAX_STRING];	/* Flawfinder: ignore */  		// *NOTE: This buffer size is hard coded into scanf() below.  		char keyword[MAX_STRING];	/* Flawfinder: ignore */ @@ -3077,8 +3079,14 @@ BOOL LLViewerObject::loadTaskInvFile(const std::string& filename)  		while(ifs.good())  		{  			ifs.getline(buffer, MAX_STRING); -			sscanf(buffer, " %254s", keyword);	/* Flawfinder: ignore */ -			if(0 == strcmp("inv_item", keyword)) +			if (sscanf(buffer, " %254s", keyword) == EOF) /* Flawfinder: ignore */ +			{ +				// Blank file? +				LL_WARNS() << "Issue reading from file '" +						<< filename << "'" << LL_ENDL; +				break; +			} +			else if(0 == strcmp("inv_item", keyword))  			{  				LLPointer<LLInventoryObject> inv = new LLViewerInventoryItem;  				inv->importLegacyStream(ifs); @@ -3091,9 +3099,17 @@ BOOL LLViewerObject::loadTaskInvFile(const std::string& filename)  				inv->rename("Contents");  				mInventory->push_front(inv);  			} +			else if (fail_count >= MAX_INV_FILE_READ_FAILS) +			{ +				LL_WARNS() << "Encountered too many unknowns while reading from file: '" +						<< filename << "'" << LL_ENDL; +				break; +			}  			else  			{ -				LL_WARNS() << "Unknown token in inventory file '" +				// Is there really a point to continue processing? We already failing to display full inventory +				fail_count++; +				LL_WARNS_ONCE() << "Unknown token while reading from inventory file. Token: '"  						<< keyword << "'" << LL_ENDL;  			}  		} | 
