#3814 Handle bad_allocs in unpackVolumeFaces - #6112
Open
akleshchev wants to merge 1 commit into
Open
Conversation
akleshchev
requested review from
maxim-productengine
and
a lite review from Copilot
August 11, 2026 11:22
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens LLVolume::unpackVolumeFaces() against memory-allocation failures and implausible compressed payload sizes while unpacking mesh volume faces, aiming to avoid crashes and improve resiliency during mesh streaming/decode.
Changes:
- Added a compressed-size sanity check (rejecting non-positive or very large inputs) before attempting unzip/decode.
- Wrapped unzip + decode in
try/catchto handlestd::bad_alloc,std::exception, and unknown exceptions with logging and safer failure behavior. - Introduced mainloop
WorkQueueposting for the small-mesh OOM path to surface an OOM user warning / fatal on the main loop.
Suppressed comments (1)
indra/llmath/llvolume.cpp:2416
main_queue->post()can fail (e.g. if the queue is closed) and the return value is currently ignored, which can drop the out-of-memory handler in the “small mesh” path. Please check the return value and fall back to a local warning when posting fails.
const LLUUID mesh_id_copy = mesh_id; // capture by value for the lambda
main_queue->post([mesh_id_copy, size]()
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS("MeshStreaming") << "Out of memory unpacking mesh id " << mesh_id_copy
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+2339
to
+2346
| const LLUUID mesh_id_copy = mesh_id; // capture by value for the lambda | ||
| main_queue->post([mesh_id_copy, size]() | ||
| { | ||
| LLError::LLUserWarningMsg::showOutOfMemory(); | ||
| LL_ERRS("MeshStreaming") << "Out of memory unpacking mesh id " << mesh_id_copy | ||
| << " of compressed size " << size << LL_ENDL; | ||
| }); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Will fix. But if main_queue is closed, we are shuting down and don't really care, memory will be freed soon.
akleshchev
force-pushed
the
andreyk/viewer_2814_20
branch
from
August 11, 2026 12:31
2fe8fb5 to
ee1789b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handle bad_allocs in unpackVolumeFaces