nuPickers icon indicating copy to clipboard operation
nuPickers copied to clipboard

GetPickedEditorDataItems causes OutOfMemory exception

Open mbilas opened this issue 3 years ago • 2 comments

Hello, our Umbraco 7 instance has integrated nuPickers editors. We are mainly focused on work with DotNetCheckBoxPicker. Recently we were affected by an issue with memory clogging on our web server. Our investigation led us to GetPickedEditorDataItems method used on mentioned picker property. When it happened? When this method was used many times in short period of time (ex. 35 calls per second). All available memory servers was full and IIS server has not responded. Every operation ended with OutOfMemoryException. The last information in logs before the server was killed:

System.NullReferenceException: Object reference not set to an instance of an object. 
at IEnumerable<EditorDataItem> nuPickers.Shared.DotNetDataSource.DotNetDataSource.nuPickers.Shared.DataSource.IDataSource.GetEditorDataItems(int currentId, int parentId, string[] keys) 
at IEnumerable<EditorDataItem> nuPickers.Shared.Editor.Editor.GetEditorDataItems(int currentId, int parentId, string propertyAlias, IDataSource dataSource, string customLabelMacro, string[] keys) 
at IEnumerable<EditorDataItem> nuPickers.Picker.GetPickedEditorDataItems() 

We are using the most recent version 1.7.1. Any chance to check GetPickedEditorDataItems what can be wrong that it takes up a lot of memory?

mbilas avatar Mar 05 '21 09:03 mbilas

Hi there, just a note to say that I'm experiencing an issue with this also. In my application calling this method seems to load a duplicate instance of the uComponents.nuPickers.dll into the Application Domain.

Repeatable by calling the method and then checking:

AppDomain currentDomain = AppDomain.CurrentDomain; Assembly[] assems = currentDomain.GetAssemblies();

@mbilas, do you manage to find a fix for this?

christopher-thomas avatar Feb 08 '22 08:02 christopher-thomas

Hi @christopher-thomas, we have introduced a cache, so now GetPickedEditorDataItems method is called only once for a given period of time (of course short). It looks that it is a solution for that case only.

mbilas avatar Feb 08 '22 08:02 mbilas