Problems with registering new PageType after deploy



We've experience an issue twice after deploy, where a new PageType won't get registred in the database correctly.

It is listed inside the Admin/Content Types interface, but if we try to create a page we get the following database error.

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblContent_tblContentType". The conflict occurred in database "Website_V2", table "dbo.tblContentType", column 'pkID'.

To fix the issue we've had to restart the two instances on our App Service in Azure. After the first instance is restarted it shows up correctly in the database and becomes usable.

We're running CMS Core

We can't recreate the issue on our development, QA or Stage environments. We're running two instances on our production environment, which might have something to do with it.

And just to note - the guid of the PageType is unique and we are running with enableModelSyncCommit enabled in production.

Edited, Mar 30, 2020 14:01

As your error message, the pkID is conflicted. This field is not guid of content type, this field type is integer, auto increment. I guess that many insert content type queries are called same time behind the scene

Mar 31, 2020 4:13
Mar 31, 2020 4:46

Are you using deployment slots? If a deployment slot, or instance, is running the old version of the code (without the page type) against the same database this problem could occur.

Mar 31, 2020 6:11

Hi thanks for your answers :)

@Binh, that would seem like a possible issue - but in both cases we've only been adding one new PageType, also even if multiple request are made wouldn't one of them go through - we've also only seen this issue in production (not on our development machines, qa or stage environment).

@Tomas, we are running deployment slots in prodution, but also in our QA environment were we haven't seen the issue. Could it be a mixture of multiple instances and deployment slots?

Mar 31, 2020 7:04
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.