Getting Out of memory exception with 23.6 version and object reference error in 23.7 version when trying to convert HTML to tiff image in Linux environment

Sir, We are using the licensed version of Aspose.Total. I am getting the Out of memory Exception when trying to convert HTML to tiff image in Linux environment. error after deploying the application in AWS ECS Fargate Linux environment. In local windows system, it is working as expected.

We are using 23.6 version. Please help to resolve this issue.

Source : System.Drawing.Common, Message : Out of memory., StackTrace : at System.Drawing.SafeNativeMethods.Gdip.CheckStatus(Int32 status)
at System.Drawing.Graphics.SetClip(Region region, CombineMode combineMode)
at Aspose.Html.Rendering.Image.ImageDevice.Clip(FillMode mode)
at .(Boolean , , Single , , , )
at .(​ , Boolean )
at .(​ , Boolean )
at .( , Boolean , ​ )
at .( , , Boolean , ​ )
at . (IDevice , CancellationToken )
at . (Renderer , [] , IDevice , CancellationToken )
at Aspose.Html.Rendering.HtmlRenderer.(IDevice , CancellationToken , Element[] , Document[] )
at Aspose.Html.Rendering.HtmlRenderer.Render(IDevice device, TimeSpan timeout, Document[] documents)
at Aspose.Html.Rendering.Renderer1.Render(IDevice device, TDocument document, TimeSpan timeout) at Aspose.Html.Rendering.Renderer1.Render(IDevice device, TDocument document)
at .( , IDevice )
at . ( , ImageSaveOptions , ICreateStreamProvider )
at Aspose.Html.Converters.Converter.ConvertHTML(HTMLDocument document, ImageSaveOptions options, ICreateStreamProvider provider)

I tried using 23.7 version and getting the below exception now. Please help

Aspose.HTML, Message : Object reference not set to an instance of an object., StackTrace : at . ( , Char )
at . ( )
at .( , , )
at …ctor( , IBrowsingContext , )
at …ctor(Node , , )
at …ctor(Element , )
at .(Element , , ​ , , , )
at .(Element , , ​ , )
at .(Document , RenderingOptions , IDevice , , , )
at . (IDevice , )
at .()
at . (Renderer , [] , IDevice , CancellationToken )
at Aspose.Html.Rendering.HtmlRenderer.(IDevice , CancellationToken , Element[] , Document[] )
at Aspose.Html.Rendering.HtmlRenderer.Render(IDevice device, TimeSpan timeout, Document[] documents)
at Aspose.Html.Rendering.Renderer1.Render(IDevice device, TDocument document, TimeSpan timeout) at Aspose.Html.Rendering.Renderer1.Render(IDevice device, TDocument document)
at .( , IDevice )
at . ( , ImageSaveOptions , ICreateStreamProvider )
at Aspose.Html.Converters.Converter.ConvertHTML(HTMLDocument document, ImageSaveOptions options, ICreateStreamProvider provider)

@alagar.btech

For the above issue, have you tried using 23.7? Are you still getting the same exception using the 23.7 version? Can you please share complete environment details along with the sample code snippet and sample HTML? We will log an investigation ticket and share the ID with you.

When we are using 23.7, I am getting different exception. “Object reference not set to an instance of an object”.

Currently this application is deployed in AWS ECS Fargate Linux container. I have added the required libgdiplus in the docker reference.

Aspose.HTML, Message : Object reference not set to an instance of an object., StackTrace : at . ( , Char )
at . ( )
at .( , , )
at …ctor( , IBrowsingContext , )
at …ctor(Node , , )
at …ctor(Element , )
at .(Element , , ​ , , , )
at .(Element , , ​ , )
at .(Document , RenderingOptions , IDevice , , , )
at . (IDevice , )
at .()
at . (Renderer , [] , IDevice , CancellationToken )
at Aspose.Html.Rendering.HtmlRenderer.(IDevice , CancellationToken , Element[] , Document[] )
at Aspose.Html.Rendering.HtmlRenderer.Render(IDevice device, TimeSpan timeout, Document[] documents)
at Aspose.Html.Rendering.Renderer1.Render(IDevice device, TDocument document, TimeSpan timeout) at Aspose.Html.Rendering.Renderer 1.Render(IDevice device, TDocument document)
at .( , IDevice )
at . ( , ImageSaveOptions , ICreateStreamProvider )
at Aspose.Html.Converters.Converter.ConvertHTML(HTMLDocument document, ImageSaveOptions options, ICreateStreamProvider provider)

Team, I am also getting the same exception when I try to use 23.7 please refer the below. Please communicate once it is fixed.

Aspose.HTML, Message : Object reference not set to an instance of an object., StackTrace : at . ( , Char )
at . ( )
at .( , , )
at …ctor( , IBrowsingContext , )
at …ctor(Node , , )
at …ctor(Element , )
at .(Element , , ​ , , , )
at .(Element , , ​ , )
at .(Document , RenderingOptions , IDevice , , , )
at . (IDevice , )
at .()
at . (Renderer , [] , IDevice , CancellationToken )
at Aspose.Html.Rendering.HtmlRenderer.(IDevice , CancellationToken , Element[] , Document[] )
at Aspose.Html.Rendering.HtmlRenderer.Render(IDevice device, TimeSpan timeout, Document[] documents)
at Aspose.Html.Rendering.Renderer1.Render(IDevice device, TDocument document, TimeSpan timeout) at Aspose.Html.Rendering.Renderer1.Render(IDevice device, TDocument document)
at .( , IDevice )
at . ( , ImageSaveOptions , ICreateStreamProvider )
at Aspose.Html.Converters.Converter.ConvertHTML(HTMLDocument document, ImageSaveOptions options, ICreateStreamProvider provider)

@alagar.btech

We have updated the ticket information as per your post and will surely let you know as soon as it is investigated and we have some news about its fix ETA. Please spare us some time.

We are sorry for the inconvenience.

@asad.ali. Thanks for the update. Kindly inform once it is fixed. Below is the detailed information.

When we are using 23.7, I am getting different exception. “Object reference not set to an instance of an object”.

Currently this application is deployed in AWS ECS Fargate Linux container. I already added the required libgdiplus in the docker reference.

Aspose.HTML, Message : Object reference not set to an instance of an object., StackTrace : at . ( , Char )
at . ( )
at .( , , )
at …ctor( , IBrowsingContext , )
at …ctor(Node , , )
at …ctor(Element , )
at .(Element , , ​ , , , )
at .(Element , , ​ , )
at .(Document , RenderingOptions , IDevice , , , )
at . (IDevice , )
at .()
at . (Renderer , [] , IDevice , CancellationToken )
at Aspose.Html.Rendering.HtmlRenderer.(IDevice , CancellationToken , Element[] , Document[] )
at Aspose.Html.Rendering.HtmlRenderer.Render(IDevice device, TimeSpan timeout, Document[] documents)
at Aspose.Html.Rendering.Renderer1.Render(IDevice device, TDocument document, TimeSpan timeout) at Aspose.Html.Rendering.Renderer 1.Render(IDevice device, TDocument document)
at .( , IDevice )
at . ( , ImageSaveOptions , ICreateStreamProvider )
at Aspose.Html.Converters.Converter.ConvertHTML(HTMLDocument document, ImageSaveOptions options, ICreateStreamProvider provider)

@alagar.btech

We have moved all your posts in the same thread and have attached the ticket ID HTMLNET-4769 here as well. We will surely inform you as soon as we get some updates about ticket resolution. We are sorry for the inconvenience.

@asad.ali,

Please let me know if you have any updates on it. We are waiting for the update to move forward with your deployments.

Thanks.

@alagar.btech

We are afraid that the logged ticket has not been yet resolved as it was recently logged in our issue tracking system. Nevertheless, we have recorded your concerns and will surely inform you as soon as we make some updates in this regard. Please spare us some time.

We are sorry for the inconvenience.

@asad.ali,

Almost a week is complete after I report this issue. Please let me know the ETA to complete this. We need to plan accordingly based upon your ETA since it is a blocker for us. Kindly provide some point of contact atleast to whom we can work with to resolve this issue.

Thanks.

@alagar.btech

We do realize the issue severity for you. However, the issues are resolved as per the fairest policy of first come first serve in free support model. Nevertheless, your concerns have been recorded and we will consider them during ticket investigation. We will inform you once we have some updates to share in this regard.

PS: You can also check our priority support option in case the issue is a blocker for you and you need to get it resolved on urgent basis.

@alagar.btech

In version 23.8.0, we have fixed a similar bug. Could you please check if the exception is reproduced in it.

@asad.ali, I am getting the below exception in 23.8.0 -> “Out of memory”

ExceptionDescription: "Source : System.Drawing.Common, Message : Out of memory., StackTrace : at System.Drawing.SafeNativeMethods.Gdip.CheckStatus(Int32 status)
at System.Drawing.Graphics.SetClip(Region region, CombineMode combineMode)
at Aspose.Html.Rendering.Image.ImageDevice.Clip(FillMode mode)
at .(Boolean , , Single , , , ​ )
at .( , Boolean )
at .( , Boolean )
at .( , Boolean , )
at .( , , Boolean , )
at . (IDevice , CancellationToken )
at . (Renderer , [] , IDevice , CancellationToken )
at Aspose.Html.Rendering.HtmlRenderer.(IDevice , CancellationToken , Element[] , Document[] )
at Aspose.Html.Rendering.HtmlRenderer.Render(IDevice device, TimeSpan timeout, Document[] documents)
at Aspose.Html.Rendering.Renderer1.Render(IDevice device, TDocument document, TimeSpan timeout) at Aspose.Html.Rendering.Renderer1.Render(IDevice device, TDocument document)
at .( , IDevice )
at . ( , ImageSaveOptions , ICreateStreamProvider )
at Aspose.Html.Converters.Converter.ConvertHTML(HTMLDocument document, ImageSaveOptions options, ICreateStreamProvider provider)

@alagar.btech

Thanks for your feedback. We have updated the ticket information accordingly and will get back to you once we have some results against the investigation.

@alagar.btech

The “Out of memory” error is most likely due to the fact that in Linux GDI does not compress TIFF images, which is why they take up a lot of space. At the moment, we can suggest using a different picture format, such as .png. We are working on the transition from GDI to other rendering systems, but it will not be completed in the near future, it will probably take 6-7 months.