Error when Redis cache is enabled

1 year ago
Hello, as from the title there is an exception with a self referencing loop issue when using the template.
error is shown when visiting the website.

link to site:
http://dnn-sa.azurewebsites.net/en/


-  nop Commerce Version  4.10
- how the issue is produced: visit the website
- no private modifications


AggregateException: One or more errors occurred. (Self referencing loop detected for property 'ConditionGroupEntity' with type 'SevenSpikes.Nop.Conditions.Domain.ConditionGroup'. Path '1.ConditionEntity.ConditionGroups[0].ConditionStatements[0]'.)


Stack trace

System.AggregateException: One or more errors occurred. (Self referencing loop detected for property 'ConditionGroupEntity' with type 'SevenSpikes.Nop.Conditions.Domain.ConditionGroup'. Path '1.ConditionEntity.ConditionGroups[0].ConditionStatements[0]'.) ---> Newtonsoft.Json.JsonSerializationException: Self referencing loop detected for property 'ConditionGroupEntity' with type 'SevenSpikes.Nop.Conditions.Domain.ConditionGroup'. Path '1.ConditionEntity.ConditionGroups[0].ConditionStatements[0]'.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference(JsonWriter writer, Object value, JsonProperty property, JsonContract contract, JsonContainerContract containerContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contrac
1 year ago
I did a hacky way( check the type of the object) to see the type causing the issue and skip caching it(its for sale of the day by nop-templates), just wanted to see how the speed is going to be.

Why is nopcommece is very, very slow with redis? did anyone encoutered this ? both the app-service, and the cache server are in the same zone in azure
1 year ago
saad77 wrote:
'SevenSpikes.Nop.Conditions.Domain.ConditionGroup'

I presume it's realted to nop-templates plugins or themes. Please contact them to resolve this issue
1 year ago
hello, you are right, and i opened a ticket, and have done a work around as mentioned earlier.

the issue now is the Website is much slower when using a caching server, can you help me ?
1 year ago
saad77 wrote:
hello, you are right, and i opened a ticket, and have done a work around as mentioned earlier.

the issue now is the Website is much slower when using a caching server, can you help me ?


Hi Saad,

We have replied in our forums to your post as well to your ticket.

You should be able to continue using Redis for caching as we corrected the issue you have specified.
Please see the reply to the ticket you have submitted.

p.s: For those who are interested what the problem is and how to solve it.
The Redis cache serializes the cached objects to JSON and then deserializes them to objects and if there are some complex objects that have properties referencing to a parent object they could not be serialized. This is not a problem for the memory cache manager or if you are using binary serialization. You can use JsonIgnore attribute to tell the serializer to simply ignore such properties.

Hope this helps!

Thanks,
Boyko
1 year ago
Ok Got it,

for anyone interested, Nop-templates fixed the issue , and passed a DLL for the fix
1 year ago
Did they update the dlls in their main code packages?  We purchased the element theme package 2 months ago, and when we connect it to redis, its is horribly slow.....

We downloaded the latest code from them 2 weeks ago.

If there is an update somewhere, can you point us to it?

Thanks
Dave