6

I am seeing an issue in the Content Management side. When I publish a Page, I am seeing the RenderedContent in the JSON output for some Component Templates. When I republish the Page again, I am not seeing the RenderedContent output in the JSON. But this is happening intermittently.

Upon comparing the created JSONs for different languages, we are seeing the below line for French version whereas in English it does not exist.

"RenderedContent": "{\"Component\":{\"LastPublishedDate\":......}

Does anyone have an idea on how to fix this issue?

Additional details:

  • This issue(JSON content of the associated pages with the published linked component has rendered content tag which prevents the DXA framework from recognizing the content and hence displaying empty content on the page) occurs intermittently when the content publishing team takes linked components and associated pages through the publishing workflow.
  • When the page is republished or previewed on CMS the JSON content is showing properly.
  • In response to Shiva's comment, we could correlate the issue with the dd4t JSON serialization code. Is it possible the below code is related to the issue?

https://github.com/sdl/dxa-content-management/blob/d385ae567eab09551b320a1e91c7393a158af631/Sdl.Web.Tridion.Templates.Legacy/DD4T/DD4T.Templates.Base/Builder/ComponentPresentationBuilder.cs

<< try { // we cannot be sure the component template uses the same serializer service as the page template // so we will call a factory which can detect the correct service based on the content ISerializerService serializerService = SerializerServiceFactory.FindSerializerServiceForContent(dd4tData); cp = serializerService.Deserialize(dd4tData);
                // inital renderedContent could contain si4t search data. we need to preserve the search data. 
                // lets retrieve the si4t search data if that's the case and added to the renderedContent property
                cp.RenderedContent = Si4tUtils.RetrieveSearchData(renderedContent);
            }
            catch (Exception e)
            {
                log.Error("exception while deserializing into CP", e);
                // the component presentation could not be deserialized, this probably not a Dynamic Delivery template
                // just store the output as 'RenderedContent' on the CP
                cp.RenderedContent = renderedContent;
                // because the CT was not a DD4T CT, we will generate the DD4T XML code here
                cp.Component = manager.BuildComponent(tcmComponentPresentation.Component);
            }

Further findings: Below are further findings:

  1. The issue is reported both in English and French pages.
  2. The templates are not localized and we are leveraging the framework TBBs
    TBBs in Page Template:
    Render Page Content
    Default Page Template Finish Actions
    TBBs in Component Template:
    Render Component Content
    Default Component Template Finish Actions
  3. The issue is intermittent only in production environment from Dec 3rd week and not able to replicate in lower environment
  4. The issue get fixed after republishing the page again to that specific target
  5. When we analyze the page record in Broker DB we noticed that the JSON is not de-serialized for some of the fields and the field content is added to "RenderedContent" attribute
  • 2
    You're not supposed to see RenderedContent if the component presentation is also rendered with a DD4T / DXA template. The fact that you're getting escaped JSON in the RenderedContent property, is the real issue, I suspect. – Quirijn Jan 2 '18 at 17:30
  • 1
    As I answered in tridion.stackexchange.com/questions/17961/… this is indeed not supposed to happen and other than that instance, I haven't heard anyone mentioning it before. You mention in your title it is intermittent, but in your description you mention you see it in French and not in English. Can you edit your question and provide more details? If it is an intermittent problem, and that only occurs in the French version, I would focus my attention on there. Can you clarify if the CT may be localized and contains additional TBBs? – Bart Koopman Jan 3 '18 at 8:59
  • 1
    Like Bart and Quirijn highlighted above, you should not be seeing the RenderedContent in the JSON. I suggest that you start off by checking your CM server event logs for this and see if you notice any DD4T serialization errors. The fact that you are noticing this randomly may suggest that it could be related to an underlying Newtonsoft issue (github.com/JamesNK/Newtonsoft.Json/issues/469), which is being used by DD4T. I suspect a potential defect in the underlying framework here. Quite clearly, if you republish the item; it may succeed without any issues. – Shiva Jan 4 '18 at 21:37
  • 1
    @BartKoopman - This issue is not language specific and occurring intermittently on pages which has multiple linked components. We tried to compare english page content (didn't had issue) and french page content and found the difference in JSON structure. – Suresh Jan 5 '18 at 18:58
  • 1
    Added further findings to the question – Suresh Jan 5 '18 at 20:05
3

This is related to the concurrency issue that @Shiva highlighted, but in fact is not limited to just the content management side. It also affects the content delivery side and can result in extremely unstable environment (esp. under load).

The concurrency problem wasn't fixed until DD4T.Model v2.2.2, and therefore is an issue with almost every version of DXA up until v2.0.

It has been documented in detail in this Github issue, with additional details on the solution as follows:

  1. Updated to the latest version of Newtonsoft JSON.Net (e.g. v10+)
  2. Manually patch the web application & template building blocks projects with a replacement version of the DD4T.Serialization.dll -- manually hotfixed using the logic from DD4T v2.2.2.

This is directly related this Stack Overflow question here also as it affects many versions of DXA.

1

I recommend that you add the DD4T concurrency fix in your environment highlighted here

This stack exchange question answers how you can accomplish the change in DXA 1.2. You can follow a similar approach for DXA 1.5 and use ILMerge to get the DD4T.Templates.Merged.dll.

We are not seeing the above issue after the fix highlighted above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.