KevinJump / uSync

Database syncing tool for Umbraco CMS
https://jumoo.co.uk/usync/
Mozilla Public License 2.0
109 stars 63 forks source link

An import of lots of datatypes can restart site and abort import #18

Closed KevinJump closed 4 years ago

KevinJump commented 5 years ago

When you do a full import of datatypes (especially with Models builder in PureLive Mode) - the import might hang:

Running in debug we get this error :

System.Runtime.Serialization.SerializationException HResult=0x8013150C Message=Type is not resolved for member 'Umbraco.Core.Security.UmbracoBackOfficeIdentity,Umbraco.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null'. Source= StackTrace:

This appears to be coming from the internal serialization within Umbraco when the cache event is triggered.

we have a debug option to use batch saving, that is don't save the datatypes individually but in one block when at the end, using dataTypeService.Save(items) - but this also causes the error.

turning models builder off live mode, makes this largely go away - but that just might be because it reduces the number of cache rebuilds in Umbraco.

the datatype serializer updates the datatypes here https://github.com/KevinJump/uSync8/blob/master/uSync8.Core/Serialization/Serializers/DataTypeSerializer.cs#L34

the save happens in the parent class or in the handler if we are doing a 'batch' save. So all saves go through these two save functions here : https://github.com/KevinJump/uSync8/blob/master/uSync8.Core/Serialization/Serializers/DataTypeSerializer.cs#L181

the issue was already happening when using hte direct save in DeserializeCore that is now commented out

JCrepin commented 5 years ago

IIRC, this error occurs during an App Domain restart from Umbraco, and the error occurs from the IIS process (w3wp), because IIS doesn't know about the custom class Umbraco uses for membership.

I never managed to find a solid fix aside from turning off live mode for models builder, but my assumption is that this is because of the app restart that occurs due to this setting. https://docs.microsoft.com/en-us/dotnet/api/system.web.configuration.compilationsection.numrecompilesbeforeapprestart?view=netframework-4.8

KevinJump commented 5 years ago

Having checked with people - the best we can do at the moment is make batch mode, as save light as possible, as such the update above, reduces the number of saves we make in batch mode, it also stops the triggering of events when datatypes are saved - Which I am not 100% happy with - but it will be for batch mode only so hopefully not an issue.

KevinJump commented 5 years ago

Removing the Event Trigger from the datatypes causes other issues.

putting it back, causes the models builder issue to happen on forced imports :(

John-Blair commented 4 years ago

I had this problem. I fixed it by changing the web.cofig modelsmode in my import site from PureLive to DLL i.e. this makes models building manual, allowing me to import lots of Data Types without any issues.

<add key="Umbraco.ModelsBuilder.ModelsMode" value="Dll" />

KevinJump commented 4 years ago

yep - that's our current recommendation, (we have it in the readme now - https://jumoo.co.uk/usync/modelsbuilder)

This is issue still open because we are not sure if it also relates to the other NuCache issue #40 (which it might not, but we are testing stuff).

KevinJump commented 4 years ago

i think most of these issues are resolved in Umbraco 8.2.+ installations.