Hello everyone,
since last week I noticed that sometimes processes failed with an OutOfMemory exception.
At first I thought there was some error in the way I am converting from XML=>JSON (using a custom c# code with JsonNet instead of the standard process step), but today apparently the same happen during an XSLT transformation.
Inner Exception Message: Insufficient memory within specified address space range to continue the execution of the program.
Inner Exception Trace: at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
at Neuron.Esb.Pipelines.EsbMessageBodyXslTransformPipelineStep.transformLocal(XslCompiledTransform compiledTransform, IXPathNavigable input, Func`2 getParameterValue)
at Neuron.Esb.Pipelines.EsbMessageBodyXslTransformPipelineStep.OnExecute(PipelineContext`1 state)
at Neuron.Pipelines.PipelineStep`1.Execute(PipelineContext`1 state)
Exception Type: Newtonsoft.Json.JsonSerializationException
Exception Message: Error getting value from 'parentItem' on '__DynamicCode.Row'.
Exception Trace: at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
Inner Exception Type: System.OutOfMemoryException
Inner Exception Message: Insufficient memory within specified address space range to continue the execution of the program.
Inner Exception Trace: at GetparentItem(Object )
at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
the specific Neuron instance is currently taking up 3,5GB of memory but it has 42GB of committed memory in total.
Could that be the reason why process fails? What could be the cause of such a memory use?
Thank you
Fabrizio
Tags:
how big is the document that you are trying translate?
Hi Marty,
the document was quite small. I'm trasnalting xml => C# class => JSON so that I can have the control over the root of the resulting json as well as the property type. But still, I'm talking about small docs, it can vary from few byes (one element array, 10/15 properties) to an array of 200 elements.
The XSLT eror happened this morning but probably it was more related to the amount of memory that was allocated by the NeuronESB process, almost every service was failing.
We should probably take a look at your solution.....you may be creating and holding a lot of large things in memory. in any case, this is a known issue with .NET 4.6.1. You can try the work around that Microsoft posted...modifying the registry. Here's the link: https://support.microsoft.com/en-us/help/3152158/out-of-memory-exce...
I will send you the solution to you by email.
I've read the MS workaround, if nothing comes up from the solution, I will consider modifying the registry.
F.
Ok...
I've actually found that was my code that was not cleaning properly the resources.
XmlSerializer serializer = new XmlSerializer(typeof (myObj)); //, new System.Xml.Serialization.XmlRootAttribute("root"));
I thought that would have been somehow cleaned automatically once the process was completed, I was wrong :-(
Just for info.. here is the full code I'm using, Hope it can help.
XmlSerializer serializer = new XmlSerializer(typeof (MyObj));
MyObj wo = null;
using(var reader = new System.IO.StringReader(context.Data.Text)){
wo = (MyObj) serializer.Deserialize(reader);
}
context.Data.Text = Newtonsoft.Json.JsonConvert.SerializeObject(wo);
Neuron ESB Product Support Forums and Communities
© 2024 Created by Neuron Admin. Powered by