Aspose.Slides for .NET Causes Out of Memory Error when Deployed as Azure WebJob

Hi,

I am attempting to retrieve thumbnails from PowerPoint presentation. The code works perfectly on my local machine and an Azure VM, but we are targeting deployment as an Azure WebJob. When deployed as an Azure WebJob the code fails with the following error:

[09/14/2018 11:48:32 > ce0371: INFO] Aspose.Slides.PptxReadException: Out of memory. ---> System.OutOfMemoryException: Out of memory.
[09/14/2018 11:48:32 > ce0371: INFO]    at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
[09/14/2018 11:48:32 > ce0371: INFO]    at Aspose.Slides.ImageCollection.AddImage(MemoryStream stream)
[09/14/2018 11:48:32 > ce0371: INFO]    at Aspose.Slides.  ?.(    )
[09/14/2018 11:48:32 > ce0371: INFO]    at Aspose.Slides.  ?.(    )
[09/14/2018 11:48:32 > ce0371: INFO]    at Aspose.Slides.  ?.(?   , IPresentation )
[09/14/2018 11:48:32 > ce0371: INFO]    at Aspose.Slides.  ?.(Presentation , Stream , InterruptionToken )
[09/14/2018 11:48:32 > ce0371: INFO]    --- End of inner exception stack trace ---
[09/14/2018 11:48:32 > ce0371: INFO]    at Aspose.Slides.  ?.(Presentation , Stream , InterruptionToken )
[09/14/2018 11:48:32 > ce0371: INFO]    at Aspose.Slides.Presentation.(Stream , Boolean )
[09/14/2018 11:48:32 > ce0371: INFO]    at Aspose.Slides.Presentation.(Stream , Boolean )
[09/14/2018 11:48:32 > ce0371: INFO]    at Aspose.Slides.Presentation.(Stream )
[09/14/2018 11:48:32 > ce0371: INFO]    at Aspose.OOM.Repro.Program.Main(String[] args) in C:\Users\source\repos\Aspose.OOM.Repro\Aspose.OOM.Repro

I can provide you with repro code and document if you like.

@hamishm,

I have observed the stack trace shared by you and it seems you need to increase the heap size on your target environment. Please try this and if there is still an issue then please share the sample project along with all details about environment and Java on your end. I also suggest you to please try using latest Aspose.Slides for Java 18.8 on your end.

@mudassir.fayyaz

This is not a Java app. This is .Net.

@hamishm,

My apologies for this. Can you please share what presentation size you are using in your application that is causing issue on your end.

@mudassir.fayyaz,

the document I am currently looking at is 67MB

@hamishm,

The presentation that you are using is a huge one. Can you please try using a simple presentation on your end in your environment to see if there is no issue in API or application. Can you please also share that which assembly of Aspose.Slides for .NET 18.8 you are using on your end. Please also make sure that in your project setting you may please set x64 rather than x86.

@mudassir.fayyaz

i have tested with a number of documents of different sizes - and am only able to replicate the issue with a relatively small percentage of documents.

i have deployed 64bit binaries to the App Service, and still get the OOM issue.

locally (and on an Azure VM), the same code works.

@hamishm,

Thank you for sharing the feedback. It’s good to know that most of presentation work well on your end. For the presentations for which you are having issue in Azure environment, you can test those in simple console application on your desktop. If the issue is replicated even in console based application please share such presentation files with us. However, if the issue is not replicated in normal console based application then issue is not related to API but with environment on your end.

@mudassir.fayyaz

I completely agree that the problem is environmental. As mentioned originally, the code works fine on my local machine and on an Azure VM, but does not work when deployed as a WebJob on an Azure App Service. I just don’t understand why the API fails when deployed as a WebJob - that’s what I’m trying to figure out.

I have created a console application that reproduces the issue when deployed as a WebJob - would it be helpful if I sent this to you? If so, what would be the best way to get the files to you?

@hamishm,

Can you please share the complete stack trace of issue along with inner exception details (if any). Please also share source code that you are using for rendering. Also, please check top memory usage when this code running - if it really high (let say, more than 2Gb). Please share the requested information along with source problematic presentation.

@mudassir.fayyaz

I don’t think the problem is related to file size.

I have attached a program and a 37Kb powerpoint file that results in an Out Of Memory exception when run as a WebJob in Azure.

For clarity, the attached code works when run locally on my development machine. It only fails when deployed as an Azure WebJob.

It seems to be related to embedded objects in the powerpoint presentation. That is the common denominator in all files that fail with an Out Of Memory exception - regardless of file size.

Aspose.OOM.Repro.zip (33.9 KB)

@hamishm,

I have observed with the sample project shared by you. An issue with ID SLIDESNET-40571 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

@hamishm,

Can you please provide what is the type/configuration of web application you are using to run this WebJob?

The Service Plan type is an S1 (Standard 1: Medium)

The App Service is configured to run 64bit code.

@hamishm,

Thank you for providing the requested information.

@mudassir.fayyaz

Do you have an idea of when a fix for this will be available?

@hamishm,

We are looking into this issue and at present may not share any ETA till we completely investigate the issue on our end. We request for your patience till the time the investigation is completed and issue gets resolved.

Is this issue has already resoleved?,now I also encounter this problem.

@celerycabbage2022,
As far as I can see, the issue is not resolved yet. I’ve requested information from our developers for you. Could you please describe the issue you encountered in a new forum topic?

@celerycabbage2022,
We are working on .NET 6 support. The issue described in this forum thread is blocked by the .NET 6 support issue.