SkiaSharp icon indicating copy to clipboard operation
SkiaSharp copied to clipboard

[BUG] Unable to allocate pixels for the bitmap in Azure App service

Open DharanitharanA opened this issue 2 years ago • 2 comments

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,

AzureAppSeviceLinux-543651564.zip

DharanitharanA avatar Jun 30 '22 11:06 DharanitharanA

Hi Team,

Any update in this. It would be very helpful for us.

Thanks.

Ramaraj-Marimuthu avatar Jul 08 '22 11:07 Ramaraj-Marimuthu

Hi Team,

Any help will be appreciate.

Thanks.

Ramaraj-Marimuthu avatar Jul 15 '22 05:07 Ramaraj-Marimuthu

Hi Team,

Any update in this. It would be very helpful for us.

Thanks.

DharanitharanA avatar Oct 13 '22 06:10 DharanitharanA

What is the image dimensions? Usually that error means you have exceeded the int.maxvalue somehow.

mattleibow avatar Oct 13 '22 07:10 mattleibow

Hi @mattleibow,

  • Please find the issue creating image:
image126
  • The image dimension was : 6004 x 3283px
  • Note: This issue was producing in Azure App Service only. It works fine in Windows application.

DharanitharanA avatar Oct 13 '22 11:10 DharanitharanA

Hi @mattleibow,

Any update on this. Still i'm stucked in this issue.

Thanks in advance.

Ramaraj-Marimuthu avatar Nov 03 '22 11:11 Ramaraj-Marimuthu

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.

DharanitharanA avatar Jan 13 '23 17:01 DharanitharanA

Hi @mattleibow,

Any update on this.

Thanks.

SuriyaBalamurugan avatar Feb 09 '23 11:02 SuriyaBalamurugan

We have the same issue. Any help or workaround would me much appreciated!

robbendavid avatar Feb 27 '23 10:02 robbendavid

Any solutions?

Aschonn avatar Jul 13 '23 19:07 Aschonn

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?

m7md7sien avatar Jul 24 '23 15:07 m7md7sien