Skip to content

Fix corrupted pooling allocator state on OOM#13579

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:fix-pooling-allocator-oom
Jun 5, 2026
Merged

Fix corrupted pooling allocator state on OOM#13579
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:fix-pooling-allocator-oom

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit fixes an issue where if the pooling allocator generated OOM at just the right time then it would leave the pooling allocator in a corrupt state where the instance count was incremented, never decremented. This additionally fixes a separate issue where if an OOM happened just a bit later then it would mean that tables/memories from the pooling allocator would leak and not be properly destroyed within the allocator, leaking their slots.

This commit fixes an issue where if the pooling allocator generated OOM
at just the right time then it would leave the pooling allocator in a
corrupt state where the instance count was incremented, never
decremented. This additionally fixes a separate issue where if an OOM
happened just a bit later then it would mean that tables/memories from
the pooling allocator would leak and not be properly destroyed within
the allocator, leaking their slots.
@alexcrichton alexcrichton requested review from a team as code owners June 5, 2026 22:49
@alexcrichton alexcrichton requested review from fitzgen and removed request for a team June 5, 2026 22:49
Copy link
Copy Markdown
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oo nice find

@fitzgen fitzgen added this pull request to the merge queue Jun 5, 2026
@alexcrichton alexcrichton removed this pull request from the merge queue due to a manual request Jun 5, 2026
@alexcrichton alexcrichton added this pull request to the merge queue Jun 5, 2026
Merged via the queue into bytecodealliance:main with commit 18a8ad6 Jun 5, 2026
51 checks passed
@alexcrichton alexcrichton deleted the fix-pooling-allocator-oom branch June 5, 2026 23:44
alexcrichton added a commit that referenced this pull request Jun 6, 2026
* Fix large, backwards, `memory.copy` with fuel/epochs (#13577)

This commit fixes a bug in the previous refactorings of `memory.copy` or
other bulk copy instructions. Notably when fuel/epochs were enabled the
operation was chunked up to check fuel between each operation, but the
advancement of what to do unconditionally went forwards. When a
backwards copy is required this means that data could get corrupted if
the src/dst regions are overlapping. The fix here is to setup a separate
backwards-copy loop which handles this case so the fuel/epoch-metered
copy goes either backwards or forwards depending on what's being copied.

* Fix corrupted pooling allocator state on OOM (#13579)

This commit fixes an issue where if the pooling allocator generated OOM
at just the right time then it would leave the pooling allocator in a
corrupt state where the instance count was incremented, never
decremented. This additionally fixes a separate issue where if an OOM
happened just a bit later then it would mean that tables/memories from
the pooling allocator would leak and not be properly destroyed within
the allocator, leaking their slots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants