Thanks for the report, and sorry you're having difficulties.
There are a number of things worth checking. Since it used to work and then stopped, I suspect the cache index has become corrupted. This can happen if the disk becomes full or the website's application pool or the server has a hard restart in the middle of writing data, for instance. ImageGen does its best to recover from problems but can't always catch everything. The solution is to delete all the 'cached' folders (and their contents) so that ImageGen will recreate the cached files and index as requests come in.
You're also running a rather old version of ImageGen (2.9.0) so I'd also highly recommend you upgrade the site's /bin/imagegen.dll to the latest version (2.9.3) for important security and performance improvements as well as some bug and feature enhancements. See https://our.umbraco.org/projects/website-utilities/imagegen/ for the updater instructions and an updater package.
The out of memory error is, sadly, part of Microsoft's lousy error messages. When an api call has a problem it will return 'out of memory' which might be true (a small image file, when expanded can take quite a lot of memory in the application pool, which might not be granted very much memory depending on how your server is configured) but more likely simply means that 'something went wrong and I don't know what it is so I'll say it is an out of memory error even if it has nothing to do with memory'. The best ImageGen can do is pass the underlying error along. It isn't much help in debugging a problem though. The newer features in v2.9.3 have mitigated some of those useless errors from .net and other fixes may resolve the problem you're seeing entirely. So do start with upgrading to 2.9.3 and deleting all the 'cached' folders as part of that upgrade process.
As a side note, you set the width= parameter twice in both your urls, which you probably don't mean to do.
Let me know what you find out after the upgrade and removing the cached folders and if need be we can go from there.
On a possibly related note, we can no longer upload png and gif files to the Media folder (just to clarify, this was happening both before and after I upgraded ImageGen) - we can select file but on trying to save the uploaded image we get "Page Not Found" and the following error in the log:
2018-03-02 10:31:20,044 [128] ERROR Umbraco.Core.UmbracoApplicationBase - [Thread 113] An unhandled exception occurred
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at Umbraco.Core.IO.UmbracoMediaFile.GenerateThumbnail(Image image, Int32 maxWidthHeight, Int32 fileWidth, Int32 fileHeight, String thumbnailFileName, Boolean useFixedDimensions)
at Umbraco.Core.IO.UmbracoMediaFile.DoResize(Int32 width, Int32 height, Int32 maxWidthHeight, String fileNameAddition)
at Umbraco.Core.IO.UmbracoMediaFile.Resize(Int32 maxWidthHeight, String fileNameAddition)
at umbraco.cms.businesslogic.datatype.FileHandlerData.set_Value(Object value)
at umbraco.editorControls.uploadField.Save()
at umbraco.controls.ContentControl.SetNameAndDataTypeValues()
at umbraco.controls.ContentControl.SaveClick(Object sender, ImageClickEventArgs e)
at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
That you can't upload images is certainly a related (and possibly the same) issue that you're getting with ImageGen. The stack trace shoes that Umbraco can't generate a thumbnail of the image you uploaded. It is extremely curious if this is limited by file type. Looks like it isn't an ImageGen-specific issue.
I'd look at what has changed on the machine. The logs will give you an idea of when you started having the problem (search for the .GenerateThumbnail entires). Whatever changed will have happened somewhat before they started to appear. It might have been a server OS or .NET patch or possibly a change to Umbraco's "Image" media type settings in the backoffice or similar. Hopefully knowing the timeframe will give you a sort of "aha!" moment of memory recall of an update/change/package install that should be reviewed.
Other things to consider are file permissions. The site's application pool needs very specific permissions to various folders. Worth a triple-check.
Is this a load-balanced or blob-storage/CDN'd server? Maybe the configuration isn't quite right?
Hopefully you'll find the root of the issue with these pointers. If I think of any other items that might cause the problem I'll let you know. And do keep me posted on progress, I'm interested!
PNG files return 404 errors
We have an issue with some images not being displayed on our website - return 404 errors. They were displaying correctly but are now erroring.
It seems to be related to png/gif files, jpg files are displaying properly.
We are using Umbraco v6.1.6 and ImageGen Basic version 2.9.0.30864
Example:
https://www.lawa.org.nz/imagegen.ashx?image=/media/16863/nrwqn-00038.png&width=330&height=330&constrain=true&altimage=/img/noimage.png&width=215
The requested file exists: https://www.lawa.org.nz/media/16863/nrwqn-00038.png
And this example gives Out of Memory error. File is 120KB.
https://www.lawa.org.nz/imagegen.ashx?image=/media/2632726/waikato-photo.gif&width=330&height=330&constrain=true&altimage=/img/noimage.png&width=215
Hi, Lesley,
Thanks for the report, and sorry you're having difficulties.
There are a number of things worth checking. Since it used to work and then stopped, I suspect the cache index has become corrupted. This can happen if the disk becomes full or the website's application pool or the server has a hard restart in the middle of writing data, for instance. ImageGen does its best to recover from problems but can't always catch everything. The solution is to delete all the 'cached' folders (and their contents) so that ImageGen will recreate the cached files and index as requests come in.
You're also running a rather old version of ImageGen (2.9.0) so I'd also highly recommend you upgrade the site's /bin/imagegen.dll to the latest version (2.9.3) for important security and performance improvements as well as some bug and feature enhancements. See https://our.umbraco.org/projects/website-utilities/imagegen/ for the updater instructions and an updater package.
The out of memory error is, sadly, part of Microsoft's lousy error messages. When an api call has a problem it will return 'out of memory' which might be true (a small image file, when expanded can take quite a lot of memory in the application pool, which might not be granted very much memory depending on how your server is configured) but more likely simply means that 'something went wrong and I don't know what it is so I'll say it is an out of memory error even if it has nothing to do with memory'. The best ImageGen can do is pass the underlying error along. It isn't much help in debugging a problem though. The newer features in v2.9.3 have mitigated some of those useless errors from .net and other fixes may resolve the problem you're seeing entirely. So do start with upgrading to 2.9.3 and deleting all the 'cached' folders as part of that upgrade process.
As a side note, you set the width= parameter twice in both your urls, which you probably don't mean to do.
Let me know what you find out after the upgrade and removing the cached folders and if need be we can go from there.
cheers,
doug.
Hi Doug, I've updated ImageGen to v2.9.3 and deleted the 'cached' folders. I also removed the extra width=parameter - thanks for spotting that!
We are now getting 500 (Internal Server Errors) with png and gif files. e.g. https://www.lawa.org.nz/imagegen.ashx?image=/media/783751/kuwakakai.png&width=215&height=215&constrain=true&altimage=/img/noimage.png
returns "A generic error occurred in GDI+."
On a possibly related note, we can no longer upload png and gif files to the Media folder (just to clarify, this was happening both before and after I upgraded ImageGen) - we can select file but on trying to save the uploaded image we get "Page Not Found" and the following error in the log:
That you can't upload images is certainly a related (and possibly the same) issue that you're getting with ImageGen. The stack trace shoes that Umbraco can't generate a thumbnail of the image you uploaded. It is extremely curious if this is limited by file type. Looks like it isn't an ImageGen-specific issue.
I'd look at what has changed on the machine. The logs will give you an idea of when you started having the problem (search for the .GenerateThumbnail entires). Whatever changed will have happened somewhat before they started to appear. It might have been a server OS or .NET patch or possibly a change to Umbraco's "Image" media type settings in the backoffice or similar. Hopefully knowing the timeframe will give you a sort of "aha!" moment of memory recall of an update/change/package install that should be reviewed.
Other things to consider are file permissions. The site's application pool needs very specific permissions to various folders. Worth a triple-check.
Is this a load-balanced or blob-storage/CDN'd server? Maybe the configuration isn't quite right?
Hopefully you'll find the root of the issue with these pointers. If I think of any other items that might cause the problem I'll let you know. And do keep me posted on progress, I'm interested!
cheers,
doug.
is working on a reply...