Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ben Hill 26 posts 126 karma points
    Jun 08, 2022 @ 08:10
    Ben Hill
    0

    Out of Memory Exception - Umbraco 7

    Hi All,

    We are currently running Umbraco 7 and have noticed we keep getting an out of memory exception error in our Trace Logs, here's the error:

    An unhandled exception occurred System.OutOfMemoryException: Out of memory. at System.Drawing.Graphics.CheckErrorStatus(Int32 status) at System.Drawing.Graphics.DrawImage(Image image, Int32 x, I

    An unhandled exception occurred System.OutOfMemoryException: Out of memory. at System.Drawing.Graphics.CheckErrorStatus(Int32 status) at System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y) at System.Drawing.Graphics.DrawImageUnscaled(Image image, Int32 x, Int32 y) at ImageProcessor.Common.Extensions.ImageExtensions.Copy(Image source, AnimationProcessMode animationProcessMode, PixelFormat format, Boolean preserveExifData) at ImageProcessor.ImageFactory.Load(Stream stream) at ImageProcessor.Web.HttpModules.ImageProcessingModule.

    Has anyone had this issue before and could point me in the direction of a possible solution?

    Thank you in advance Ben

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Jun 21, 2022 @ 08:00
    Marc Goodson
    100

    Hi Ben

    Are you doing any custom manipulation of images on your site, I've seen that error before if loading an image into a memory stream to manipulate with System.Drawing and then the memory stream is closed before the image is saved... but that was like 12 years ago!

    I would imagine you would be using ImageProcessor to do any manipulation of images...

    I'd be tempted to see if you can pin down what requests are being made at the time of the trace log error, if there isn't any corresponding info in the logs as to what is happening at the time of the error, I'd cross-reference the IIS logs, at the time of the error - you might find it's an issue with a particular image, or you might find it's some kind of bot requesting an image with an invalid resize parameter...

    regards

    marc

  • Bo Jacobsen 606 posts 2404 karma points
    Jun 21, 2022 @ 08:02
    Bo Jacobsen
    0

    Hi Ben.

    Marc beat me to an answer :)

    If the error is other things than the memory stream closing before the image is saved. Then you basically needs more avaiable memory for you application.

    In our own applications using Umbraco we use between 2 to 4 GB memory for each solution. Depending on alot of things, like traffic, custom modified code and image handling.

    If your application runs on a 64 bit server. Then setting the application pool to 32-bit, will run the garbage collector more often and reduce memory usage.

    If you allow editors to upload huge image files like 50 MB +. Then it can also cause this issue.

  • Harry Spyrou 212 posts 604 karma points
    Jun 22, 2022 @ 09:54
    Harry Spyrou
    0

    To add to the previous questions, this is not a memory leak, I've ran into it too. It's always either an image is too big for the server (yes, a client put an 65mb png at some point) or as other said you're doing something with it that exceeds the memory space.

    Either way, it's most likely the Stream that's handling the image going 'I can't eat anymore, grandma'.

  • Ben Hill 26 posts 126 karma points
    Jun 22, 2022 @ 09:56
    Ben Hill
    0

    Thank you for your replies everyone, we are still investigating.

Please Sign in or register to post replies

Write your reply to:

Draft