Developer forum

Forum » Development » Error getting index information after successful index instance run when reloading index page

Error getting index information after successful index instance run when reloading index page

Mikkel Hammer
Mikkel Hammer
Reply

Hi all,

We're experiencing a weird error that we can't really pinpoint what is caused by and when it started...
We're on a DW 9.14.3, we've tried upgrading Dynamicweb.Ecommerce from 1.14.17 (came with 9.14.3) to a 1.14.47 (lastest stable version) with miminum dependencies, but it didn't help.

So everything seems normal when you first enter the index, we can run both instances with no errors or anything.


But if we then close the index and opens it again, it shows that there's nothing in the index..


Looking at the network tab it returns an error when opening it.


Here's the stacktrace:
{

    "Message": "An error has occurred.",
    "ExceptionMessage": "The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.",
    "ExceptionType": "System.InvalidOperationException",
    "StackTrace": null,
    "InnerException": {
        "Message": "An error has occurred.",
        "ExceptionMessage": "Self referencing loop detected for property 'IndexBuilder' with type 'Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder'. Path 'Builds.Products.Extenders[1]'.",
        "ExceptionType": "Newtonsoft.Json.JsonSerializationException",
        "StackTrace": "   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference(JsonWriter writer, Object value, JsonProperty property, JsonContract contract, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)\r\n   
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary(JsonWriter writer, IDictionary values, JsonDictionaryContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)\r\n   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)\r\n   
at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n   at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n   
at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()"
    }
}

​
If we restart the IIS, the index looks normal again when we open it until we run one of the instances again...

We're not really sure where the "Self reference loop" occurs at or how to debug it.
Hope anyone can see what we're missing or point us in the right direction :)

Best regards,
Mikkel Hammer
 


Replies

 
Mikkel Hammer
Mikkel Hammer
Reply

We found the issue.

One of our ProductIndexBuilders was extending "IndexBuilderExtenderBase", which had worked before, instead of "IIndexBuilderExtender".
Switching to IIndexBuilderExtender solved the issue.

Thanks Ebdrup... again... 😑

Best regards,
Mikkel Hammer

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply

Hi Mikkel,

I am running into the same problem, but changing to IIndexBuilderExtender is not fixing the issue. In fact, IndexBuilderExtenderBase inherits from IIndexBuilderExtender as well.
Any other thoughts you might have done to fix this?

 

BR, Mario

 
Mikkel Hammer
Mikkel Hammer
Reply

Hi Mario,

Unfortunately no, we had trouble finding it since it didnt throw any errors in Visual Studio when debugging on my local machine.

What we did to make sure it was one of our extenders and not a DW issue, was on the index to set "SkipExtender" to "True" which removed the error. (Shown on picture below)
But that was all we had go from.



Then it was just trial and error with looking at our extenders, and comparing to other solutions we have on nearly the same DW version.
Thats where one of my colleague noticed we used the base class and not the interface.

If you have multiple ProductIndexBuilder extenders, one way to debug could be to try and comment out the whole file, rebuild and see if the index still fails after a run.
It's slow, but maybe it can help pinpoint which one is causing the error.

Best regards,
Mikkel Hammer

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply

Hopefully @Nicolai will see this thread ;-)

This stopped working on 9.14.2, with some changes made to Dynamicweb.Ecommerce/Indexing/ProductIndexBuilder.cs, to accomodate IndexBuilder property not getting set and that is actually what is breaking looking at error code - "ExceptionMessage": "Self referencing loop detected for property 'IndexBuilder' with type 'Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder'. Path 'Builds.Products.Extenders[1]'.",

foreach (var extender in Extenders)
{
  if (extender.GetType() == typeof(IndexBuilderExtenderBase<ProductIndexBuilder>)) - OLD
  if (typeof(IndexBuilderExtenderBase<ProductIndexBuilder>).IsAssignableFrom(extender.GetType())) - NEW
  {
  IndexBuilderExtenderBase<ProductIndexBuilder> extenderBase = (IndexBuilderExtenderBase<ProductIndexBuilder>)extender;
  extenderBase.IndexBuilder = this;
extenderBase.ExtendDocument(document);
  }
  else
  {
extender.ExtendDocument(document);
     }
}

BR, Mario

 

 

 

 
Mikkel Hammer
Mikkel Hammer
Reply

Nice find Mario, hopefully they'll have a fix ready soon :)

Best regards,
Mikkel Hammer

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Bugged as #11588 - pull request made and in a release near you soon.

Sorry about this - and good find!

BR Nicolai

Votes for this answer: 2
 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply
This post has been marked as an answer

Hi Mikkel and Mario

The bug #11588 regarding property 'IndexBuilder' 
Has been fixed in Dynamicweb version 9.14.8 
You can get this version from the download section https://doc.dynamicweb.dk/downloads/dynamicweb-9

Sorry for any inconvenience this may have caused

Kind Regards
Dynamicweb Care Support
Kristian Kirkholt

Votes for this answer: 1

 

You must be logged in to post in the forum