Go to main content Go to main menu

Long string property value problem – lazy loading

By Ove Lartelius Reading time: 1 minute

Problem to load (>250 chars) long string property values. Like ImageVault MediaReference property value.

Background

I´m working in a project where we have upgrade the Optimizely CMS from v11.* to v12.*. We have a load balanced environment and realized that our hero image on the site disappears when we upgrade the database. Only one of our servers return the image. We are using ImageVault and the property that holds the Image is of type ImageVault MediaReference property.

screenshot ImageVault images

Search for the problem/error

If we go into the editor mode and just republish the page on server1 and now the image is shown on server1. The problem is that it does not show on server2 anymore. We are in a state where we could have “image server tennis”. Not fun!

screenshot of an coastline image

After debugged the code locally we could see that the reference to the media was null.

Code spec

But if we restarted all servers and went in with a local instance. Local instance also use/point to the same database, and then edited the image locally. Now server1 and server2 could not show the image anymore. Strange! Conclusion is that the first server/instance that edit/loads from the database can show the image but not the others. We thought that the problem was connected to caching or something similar.

I like to look on the source data then searching for problems, so went into the database and found the property value for this specific image.

SELECT pkID, fkContentID, LongString, LongStringLength

  FROM [cms11database].[dbo].[tblContentProperty] WHERE fkContentID = 105450 AND fkPropertyDefinitionID = 246

 

SELECT pkID, fkContentID, LongString, LongStringLength

  FROM [cms12database].[dbo].[tblContentProperty] WHERE fkContentID = 105450 AND fkPropertyDefinitionID = 246

Code spec

First TSQL statement load from the cms11 database. A snapshot of the data before upgrade.

Second TSQL statement load from the cms12 database. The one that are used of all the instances. The one that we have problem with right now.

We can see that something has changed between the 2 versions. Something happened during upgrade to cms12. The value in the long string is now much longer. Hmmmmm….

 

Thinking, searching, lunch, thinking, testing… aaaaaaaAAAAAAAA.

Found the blog/article from Meriworks https://meriworks.freshdesk.com/support/solutions/articles/11000110996-images-disappear-when-page-is-published

The problem is lazy loading in Optimizely/Episerver CMS. There is a setting that you can use to say to Optimizely/Episerver that forces Optimizely/Episerver to not use lazy load long strings when load property values from the database.

The setting is “PropertyLazyLoadThreshold” and are described in more detail in Optimizely documentation https://docs.developers.optimizely.com/content-management-system/docs/configuring-cms to add the following config to the appSettings.json.

{

  "EPiServer": {

    "CMS": {

      ...

      "Content": {

         "PropertyLazyLoadThreshold": "0"

      }

      ...

    }

  }

}

And voilà!

We can now see the image on both servers and everything is working as expected. Case closed.

I hope that someone else can find this helpful when bump into the same/similar problem.

We would like to hear what you think about the blog post

Ove Lartelius in a soffa

Ove Lartelius

Backend developer - OMVP

Read all blog posts by Ove Lartelius