SkiaSharp
SkiaSharp copied to clipboard
[BUG] Unable to allocate pixels for the bitmap in Azure App service
Description
"Unable to allocate pixels for the bitmap in Azure App service" exception throws, while decoding specific image multiple times using SkiaSharp library in Azure App service
Code
```
FileStream fileStream = new FileStream(Environment.CurrentDirectory + "/wwwroot/images/image126.png", FileMode.Open);
MemoryStream imageStream = new MemoryStream();
fileStream.CopyTo(imageStream);
fileStream.Dispose();
for (int i = 0; i <= 20; i++)
{
imageStream.Position = 0;
SkiaSharp.SKData skData = SkiaSharp.SKData.Create(imageStream);
SkiaSharp.SKBitmap.Decode(skData);
skData.Dispose();
}
```
Expected Behavior
Image should be decoded properly
Actual Behavior
Throws Unable to allocate pixels for the bitmap exception in Azure App service
Basic Information
- Version with issue: 2.88.0-preview.209
- Last known good version: 2.88.1-preview.79
- IDE: Visual Studio 2019
- Framework details: ASP.NET Core application with .NET Core 2.1 framework
- Azure App service details: P1v2 Plan
StackTrace:
System.Exception: Unable to allocate pixels for the bitmap.
at SkiaSharp.SKBitmap.Decode(SKCodec codec, SKImageInfo bitmapInfo)
at SkiaSharp.SKBitmap.Decode(SKCodec codec)
at SkiaSharp.SKBitmap.Decode(SKData data)
at AzureAppSeviceLinux.Controllers.HomeController.DecodeImage(String button)
Note: This code works properly in windows
Reproduction Link
Please deploy the below sample in Azure app service to replicate the issue,
Hi Team,
Any update in this. It would be very helpful for us.
Thanks.
Hi Team,
Any help will be appreciate.
Thanks.
Hi Team,
Any update in this. It would be very helpful for us.
Thanks.
What is the image dimensions? Usually that error means you have exceeded the int.maxvalue somehow.
Hi @mattleibow,
- Please find the issue creating image:

- The image dimension was : 6004 x 3283px
- Note: This issue was producing in Azure App Service only. It works fine in Windows application.
Hi @mattleibow,
Any update on this. Still i'm stucked in this issue.
Thanks in advance.
Hi @mattleibow,
As we have let our product to use in live, we need to resolve this issue immediately. So, your suggestions will be very helpful for us.
Thanks.
Hi @mattleibow,
Any update on this.
Thanks.
We have the same issue. Any help or workaround would me much appreciated!
Any solutions?
I faced the same issue on Windows Azure VM, and it caused "Breakpoint Has Been Reached" Error. Any insights on the root cause of this? Is it related to memory issues?