Repository navigation
Fix x86 .NET Framework threading test OOM failures (backport #3674) - #4105
Merged
mattleibow merged 1 commit intoJun 2, 2026
Merged
Conversation
Contributor
📦 Try the packages from this PRWarning Do not run these scripts without first reviewing the code in this PR. Step 1 — Download the packages bash / macOS / Linux: curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4105PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4105"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-4105/packages --name skiasharp-pr-4105More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-4105 |
Backport of #3674 to release/3.119.x. SKBitmapThreadingTest.ImageScalingMultipleThreadsTest and SKObjectTest.EnsureMultithreadingDoesNotThrow intentionally create native SkiaSharp objects WITHOUT disposing them, so they are reclaimed only by the GC and finalizer thread. This is deliberate: the tests verify that SkiaSharp objects can be finalized safely from many threads concurrently. Adding deterministic disposal would defeat the purpose of the tests. On x86 (.NET Framework, 2GB address space) the heaviest variants queue too many undisposed native allocations for the finalizer to keep up, so Skia's allocator fails ("Unable to allocate pixels"). This is a genuine address-space limit, not a leak: the 64-bit .NET Core jobs pass. Fix (matching main): skip the known-OOM combinations on x86 and add lighter intermediate variants (10x100 and 100) so concurrent GC/finalizer behavior is still exercised at lower load. Also add comments documenting the test purpose and that disposal is intentionally omitted. Co-authored-by: Copilot <[email protected]>
mattleibow
force-pushed
the
mattleibow/fix-release-3119-bitmap-tests
branch
from
May 30, 2026 18:31
ac5a352 to
ad0a4d3
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.
Problem
The internal Tests pipeline on
release/3.119.xhas been chronically red. The failing job is Windows (.NET Framework) (x86), whereSKBitmapThreadingTest.ImageScalingMultipleThreadsTest(100, 1000)andSKObjectTest.EnsureMultithreadingDoesNotThrow(1000)throwUnable to allocate pixels for the bitmap, with adjacent tests dying as collateral in the same process.Root cause (corrected)
These tests intentionally create native SkiaSharp objects without disposing them, so they are reclaimed only by the GC and finalizer thread. That is the whole point of the tests — they verify SkiaSharp objects can be finalized safely from many threads concurrently. Disposing would defeat the purpose, so an earlier "add
using" approach was wrong and has been reverted.The real issue is a genuine environment limit: on x86 (.NET Framework, 2 GB address space) the heaviest variants queue too many undisposed native allocations for the finalizer to keep pace, so Skia's allocator fails. The 64-bit .NET Core jobs have enough address space and pass.
Fix
This is a backport of #3674 (already on
main):IntPtr.Size == 4) — a sanctioned hardware/environment skip, not masking a product bug.10×100and100) so concurrent GC/finalizer behavior is still exercised on x86 at lower load.using).Files:
tests/SkiaSharp.Tests.Console/SkiaSharp/SKBitmapThreadingTest.cs,tests/Tests/SkiaSharp/SKObjectTest.cs.Validation
main's fix (Fix x86 .NET Framework threading test OOM failures (#3608) #3674) and matched its approach exactly.3.119.5-preview.0.3+merge) completed with all stages succeeded, including every Tests-stage job. Most importantly, the previously chronically-red Windows (.NET Framework) (net48/x86) job now passes — confirming the fix on the only environment that can reproduce the address-space exhaustion.Co-authored-by: Copilot [email protected]