Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrencyException raised by ContentDefinitionManager #16214

Closed
hyzx86 opened this issue Jun 3, 2024 · 10 comments
Closed

ConcurrencyException raised by ContentDefinitionManager #16214

hyzx86 opened this issue Jun 3, 2024 · 10 comments
Labels
Milestone

Comments

@hyzx86
Copy link
Contributor

hyzx86 commented Jun 3, 2024

OC version : v2.0.latest

The same problem occurs when executing an installed recipe, I applied this PR in my own repository:
A similar problem occurs when executing a tenant-installed recipe,

In my installation recipe, there are several modules similar to EasyOC.Amis that contain migration recipes, which automatically create some ContentType

After applying this PR sebastienros/yessql#568, you can see from the logs that the error message comes from ContentDefinitionRecord.

 YesSql.ConcurrencyException: The document with ID '4' and type 
'OrchardCore.ContentManagement.Metadata.Records.ContentDefinitionRecord, 
OrchardCore.ContentManagement.Abstractions' could not be updated as it has been changed by another process.
2024-06-03 00:49:20.1419|006003|OrchardCore.Data.Migration.DataMigrationManager|ERROR|::1|admin http://localhost:2919/saas/Admin
Error while running migration version 0 for 'EasyOC.Amis'. OrchardCore.Recipes.Models.RecipeExecutionException: The document with ID '4' and type 'OrchardCore.ContentManagement.Metadata.Records.ContentDefinitionRecord, OrchardCore.ContentManagement.Abstractions' could not be updated as it has been changed by another process.
 ---> YesSql.ConcurrencyException: The document with ID '4' and type 'OrchardCore.ContentManagement.Metadata.Records.ContentDefinitionRecord, OrchardCore.ContentManagement.Abstractions' could not be updated as it has been changed by another process.
   at YesSql.Commands.UpdateDocumentCommand.ExecuteAsync(DbConnection connection, DbTransaction transaction, ISqlDialect dialect, ILogger logger)
   at YesSql.Session.FlushInternalAsync(Boolean saving)
   at YesSql.Session.FlushInternalAsync(Boolean saving)
   at YesSql.Services.DefaultQuery.Query`1.FirstOrDefaultImpl()
   at OrchardCore.Data.Documents.DocumentStore.GetOrCreateMutableAsync[T](Func`1 factoryAsync)
   at OrchardCore.Documents.DocumentManager`1.GetOrCreateMutableAsync(Func`1 factoryAsync)
   at OrchardCore.Templates.Services.TemplatesManager.UpdateTemplateAsync(String name, Template template)
   at OrchardCore.Templates.Recipes.TemplateStep.ExecuteAsync(RecipeExecutionContext context)
   at OrchardCore.Recipes.Services.RecipeExecutor.<>c__DisplayClass8_0.<<ExecuteStepAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteStepAsync(RecipeExecutionContext recipeStep)
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken)
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken)
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken)
   at EasyOC.Core.Recipes.EocRecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken) in D:\SourceCodes\JZSoft\EasyOC.OrchardCore\EasyOC\src\Core\EasyOC.Core\Recipes\EocRecipeExecutor.cs:line 32
   at OrchardCore.Recipes.Services.RecipeMigrator.ExecuteAsync(String recipeFileName, IDataMigration migration)
   at EasyOC.Amis.Migrations.Migrations.CreateAsync() in D:\SourceCodes\JZSoft\EasyOC.OrchardCore\EasyOC\src\Modules\EasyOC.Amis\Migrations\Migrations.cs:line 18
   at OrchardCore.Data.Migration.DataMigrationManager.InvokeMethodAsync(MethodInfo method, IDataMigration migration)
   at OrchardCore.Data.Migration.DataMigrationManager.UpdateAsync(String featureId)    at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken)
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken)
   at OrchardCore.Recipes.Services.RecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken)
   at EasyOC.Core.Recipes.EocRecipeExecutor.ExecuteAsync(String executionId, RecipeDescriptor recipeDescriptor, IDictionary`2 environment, CancellationToken cancellationToken) in D:\SourceCodes\JZSoft\EasyOC.OrchardCore\EasyOC\src\Core\EasyOC.Core\Recipes\EocRecipeExecutor.cs:line 32
   at OrchardCore.Recipes.Services.RecipeMigrator.ExecuteAsync(String recipeFileName, IDataMigration migration)
   at EasyOC.Amis.Migrations.Migrations.CreateAsync() in D:\SourceCodes\JZSoft\EasyOC.OrchardCore\EasyOC\src\Modules\EasyOC.Amis\Migrations\Migrations.cs:line 18
   at OrchardCore.Data.Migration.DataMigrationManager.InvokeMethodAsync(MethodInfo method, IDataMigration migration)
   at OrchardCore.Data.Migration.DataMigrationManager.UpdateAsync(String featureId)

Strangely enough this issue is not reproducible in unit tests, it only occurs when performing tenant initialisation from the page

Originally posted by @hyzx86 in #15989 (comment)

@Piedone
Copy link
Member

Piedone commented Jun 3, 2024

How is this different from #15989?

@hyzx86
Copy link
Contributor Author

hyzx86 commented Jun 4, 2024

How is this different from #15989?

The difference between the two is mainly in the trigger time and the version of OC used.

@Piedone
Copy link
Member

Piedone commented Jun 4, 2024

So this has nothing to do with search or Elasticsearch, right?

@hyzx86
Copy link
Contributor Author

hyzx86 commented Jun 4, 2024

So this has nothing to do with search or Elasticsearch, right?

For now, yes. 😅

@Piedone
Copy link
Member

Piedone commented Jun 4, 2024

I see, OK then!

@sebastienros
Copy link
Member

Please update this PR's name, or even better close it and create a new one if the current code still needs to be changed.

@hyzx86
Copy link
Contributor Author

hyzx86 commented Jun 6, 2024

Please update this PR's name, or even better close it and create a new one if the current code still needs to be changed.

Updated #16212

@sebastienros sebastienros modified the milestones: 2.x, 2.0 Jun 6, 2024
Copy link
Contributor

github-actions bot commented Jun 6, 2024

We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).

This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.

1 similar comment
Copy link
Contributor

github-actions bot commented Jun 6, 2024

We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).

This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.

@sebastienros
Copy link
Member

Duplicate of #16248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants