MAINT-8308 Additional logging for mesh processing

Mon, 19 Feb 2018 21:01:34 +0200

author
andreykproductengine <andreykproductengine@lindenlab.com>
date
Mon, 19 Feb 2018 21:01:34 +0200
changeset 55296
e7f8a14d0adc
parent 55295
1cc71faf5b25
child 55297
54187156dea3

MAINT-8308 Additional logging for mesh processing

indra/llcommon/llsdserialize.cpp file | annotate | diff | revisions
indra/newview/llmeshrepository.cpp file | annotate | diff | revisions
indra/newview/llmeshrepository.h file | annotate | diff | revisions
     1.1 --- a/indra/llcommon/llsdserialize.cpp	Wed Feb 21 15:10:40 2018 +0200
     1.2 +++ b/indra/llcommon/llsdserialize.cpp	Mon Feb 19 21:01:34 2018 +0200
     1.3 @@ -2323,7 +2323,10 @@
     1.4  		U8* new_result = (U8*) realloc(result, cur_size + have);
     1.5  		if (new_result == NULL)
     1.6  		{
     1.7 -			LL_WARNS() << "Failed to unzip LLSD NavMesh block: can't reallocate memory, current size: " << cur_size << " bytes; requested " << cur_size + have << " bytes." << LL_ENDL;
     1.8 +			LL_WARNS() << "Failed to unzip LLSD NavMesh block: can't reallocate memory, current size: " << cur_size
     1.9 +				<< " bytes; requested " << cur_size + have
    1.10 +				<< " bytes; total syze: ." << size << " bytes."
    1.11 +				<< LL_ENDL;
    1.12  			inflateEnd(&strm);
    1.13  			if (result)
    1.14  			{
     2.1 --- a/indra/newview/llmeshrepository.cpp	Wed Feb 21 15:10:40 2018 +0200
     2.2 +++ b/indra/newview/llmeshrepository.cpp	Mon Feb 19 21:01:34 2018 +0200
     2.3 @@ -1618,7 +1618,7 @@
     2.4  
     2.5  				if (!zero)
     2.6  				{ //attempt to parse
     2.7 -					if (lodReceived(mesh_params, lod, buffer, size))
     2.8 +					if (lodReceived(mesh_params, lod, buffer, size) == MESH_OK)
     2.9  					{
    2.10  						delete[] buffer;
    2.11  						return true;
    2.12 @@ -1734,11 +1734,11 @@
    2.13  	return true;
    2.14  }
    2.15  
    2.16 -bool LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_params, S32 lod, U8* data, S32 data_size)
    2.17 +EMeshProcessingResult LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_params, S32 lod, U8* data, S32 data_size)
    2.18  {
    2.19  	if (data == NULL || data_size == 0)
    2.20  	{
    2.21 -		return false;
    2.22 +		return MESH_NO_DATA;
    2.23  	}
    2.24  
    2.25  	LLPointer<LLVolume> volume = new LLVolume(mesh_params, LLVolumeLODGroup::getVolumeScaleFromDetail(lod));
    2.26 @@ -1751,7 +1751,7 @@
    2.27  	catch (std::bad_alloc)
    2.28  	{
    2.29  		// out of memory, we won't be able to process this mesh
    2.30 -		return false;
    2.31 +		return MESH_OUT_OF_MEMORY;
    2.32  	}
    2.33  
    2.34  	if (volume->unpackVolumeFaces(stream, data_size))
    2.35 @@ -1763,11 +1763,11 @@
    2.36  				LLMutexLock lock(mMutex);
    2.37  				mLoadedQ.push(mesh);
    2.38  			}
    2.39 -			return true;
    2.40 +			return MESH_OK;
    2.41  		}
    2.42  	}
    2.43  
    2.44 -	return false;
    2.45 +	return MESH_UNKNOWN;
    2.46  }
    2.47  
    2.48  bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 data_size)
    2.49 @@ -2952,6 +2952,11 @@
    2.50  				body->read(body_offset, (char *) data, data_size - body_offset);
    2.51  				LLMeshRepository::sBytesReceived += data_size;
    2.52  			}
    2.53 +			else
    2.54 +			{
    2.55 +				LL_WARNS(LOG_MESH) << "Failed to allocate " << data_size - body_offset << " memory for mesh response" << LL_ENDL;
    2.56 +				processFailure(LLCore::HttpStatus(LLCore::HttpStatus::LLCORE, LLCore::HE_BAD_ALLOC));
    2.57 +			}
    2.58  		}
    2.59  
    2.60  		processData(body, body_offset, data, data_size - body_offset);
    2.61 @@ -3127,27 +3132,43 @@
    2.62  								   U8 * data, S32 data_size)
    2.63  {
    2.64  	if ((!MESH_LOD_PROCESS_FAILED)
    2.65 -		&& ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
    2.66 -		&& gMeshRepo.mThread->lodReceived(mMeshParams, mLOD, data, data_size))
    2.67 +		&& ((data != NULL) == (data_size > 0))) // if we have data but no size or have size but no data, something is wrong
    2.68  	{
    2.69 -		// good fetch from sim, write to VFS for caching
    2.70 -		LLVFile file(gVFS, mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLVFile::WRITE);
    2.71 -
    2.72 -		S32 offset = mOffset;
    2.73 -		S32 size = mRequestedBytes;
    2.74 -
    2.75 -		if (file.getSize() >= offset+size)
    2.76 +		EMeshProcessingResult result = gMeshRepo.mThread->lodReceived(mMeshParams, mLOD, data, data_size);
    2.77 +		if (result == MESH_OK)
    2.78  		{
    2.79 -			file.seek(offset);
    2.80 -			file.write(data, size);
    2.81 -			LLMeshRepository::sCacheBytesWritten += size;
    2.82 -			++LLMeshRepository::sCacheWrites;
    2.83 +			// good fetch from sim, write to VFS for caching
    2.84 +			LLVFile file(gVFS, mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLVFile::WRITE);
    2.85 +
    2.86 +			S32 offset = mOffset;
    2.87 +			S32 size = mRequestedBytes;
    2.88 +
    2.89 +			if (file.getSize() >= offset+size)
    2.90 +			{
    2.91 +				file.seek(offset);
    2.92 +				file.write(data, size);
    2.93 +				LLMeshRepository::sCacheBytesWritten += size;
    2.94 +				++LLMeshRepository::sCacheWrites;
    2.95 +			}
    2.96 +		}
    2.97 +		else
    2.98 +		{
    2.99 +			LL_WARNS(LOG_MESH) << "Error during mesh LOD processing.  ID:  " << mMeshParams.getSculptID()
   2.100 +							   << ", Reason: " << result
   2.101 +							   << " LOD: " << mLOD
   2.102 +							   << " Data size: " << data_size
   2.103 +							   << " Not retrying."
   2.104 +							   << LL_ENDL;
   2.105 +			LLMutexLock lock(gMeshRepo.mThread->mMutex);
   2.106 +			gMeshRepo.mThread->mUnavailableQ.push(LLMeshRepoThread::LODRequest(mMeshParams, mLOD));
   2.107  		}
   2.108  	}
   2.109  	else
   2.110  	{
   2.111  		LL_WARNS(LOG_MESH) << "Error during mesh LOD processing.  ID:  " << mMeshParams.getSculptID()
   2.112  						   << ", Unknown reason.  Not retrying."
   2.113 +						   << " LOD: " << mLOD
   2.114 +						   << " Data size: " << data_size
   2.115  						   << LL_ENDL;
   2.116  		LLMutexLock lock(gMeshRepo.mThread->mMutex);
   2.117  		gMeshRepo.mThread->mUnavailableQ.push(LLMeshRepoThread::LODRequest(mMeshParams, mLOD));
     3.1 --- a/indra/newview/llmeshrepository.h	Wed Feb 21 15:10:40 2018 +0200
     3.2 +++ b/indra/newview/llmeshrepository.h	Mon Feb 19 21:01:34 2018 +0200
     3.3 @@ -51,6 +51,15 @@
     3.4  class LLVFS;
     3.5  class LLMeshRepository;
     3.6  
     3.7 +typedef enum e_mesh_processing_result_enum
     3.8 +{
     3.9 +    MESH_OK = 0,
    3.10 +    MESH_NO_DATA = 1,
    3.11 +    MESH_OUT_OF_MEMORY,
    3.12 +    MESH_HTTP_REQUEST_FAILED,
    3.13 +    MESH_UNKNOWN
    3.14 +} EMeshProcessingResult;
    3.15 +
    3.16  class LLMeshUploadData
    3.17  {
    3.18  public:
    3.19 @@ -298,7 +307,7 @@
    3.20  	bool fetchMeshHeader(const LLVolumeParams& mesh_params);
    3.21  	bool fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
    3.22  	bool headerReceived(const LLVolumeParams& mesh_params, U8* data, S32 data_size);
    3.23 -	bool lodReceived(const LLVolumeParams& mesh_params, S32 lod, U8* data, S32 data_size);
    3.24 +	EMeshProcessingResult lodReceived(const LLVolumeParams& mesh_params, S32 lod, U8* data, S32 data_size);
    3.25  	bool skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
    3.26  	bool decompositionReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
    3.27  	bool physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32 data_size);

mercurial