Fixing a crash when exiting or re-entering play mode#6296
Open
Codengineer wants to merge 21 commits into
Open
Conversation
Fixes UUM-135678
…it (UUM-143767) Sensor writes during inference could overflow the tensor buffer when observation size exceeded the model's expected input, silently corrupting the allocator's internal metadata and causing non-deterministic crashes on MemoryManager::TryDeallocateWithLabel when exiting Play mode. Adds a capacity guard to ObservationGenerator's sensor write loop and bounds capping to all ObservationWriter TensorProxy write paths. Includes 13 regression tests covering overflow scenarios for every write method. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This reverts commit c84cc41.
montplaisir
reviewed
Jun 16, 2026
montplaisir
reviewed
Jun 16, 2026
montplaisir
left a comment
Contributor
There was a problem hiding this comment.
Good with 2 small fixes to do.
…to bobd/fix_crash_exit_playmode
Fixing string in warning
montplaisir
approved these changes
Jun 17, 2026
Contributor
|
/crc |
Merge branch 'update-gitignore' into bobd/fix_crash_exit_playmode
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.
Fixes UUM-135678, UUM-143767, UUM-135675, UUM-140974
Fixes a series of crash that could occur following memory overflow.
Proposed change(s)
Add tensor buffer bounds checks to prevent allocator corruption on exit (UUM-143767)
Sensor writes during inference could overflow the tensor buffer when
observation size exceeded the model's expected input, silently corrupting
the allocator's internal metadata and causing non-deterministic crashes
on MemoryManager::TryDeallocateWithLabel when exiting Play mode.
Adds a capacity guard to ObservationGenerator's sensor write loop and
bounds capping to all ObservationWriter TensorProxy write paths. Includes
13 regression tests covering overflow scenarios for every write method.
Retested intensively enter-exit play mode cycle on all user provided project and could not get it to crash again while it was crashing almost all the times before. Also tested exiting the editor in play mode in all the affected project as this was another way to trigger some of the crashes
Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)
https://jira.unity3d.com/browse/UUM-135678
https://jira.unity3d.com/browse/UUM-143767
https://jira.unity3d.com/browse/UUM-135675
https://jira.unity3d.com/browse/UUM-140974
Types of change(s)
Checklist
Other comments