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

Database breaks when multiple features are enabled in a single recipe #16346

Closed
sarahelsaig opened this issue Jun 19, 2024 · 9 comments · Fixed by #16347
Closed

Database breaks when multiple features are enabled in a single recipe #16346

sarahelsaig opened this issue Jun 19, 2024 · 9 comments · Fixed by #16347
Labels
Milestone

Comments

@sarahelsaig
Copy link
Contributor

sarahelsaig commented Jun 19, 2024

Describe the bug

Recipe with certain features will crash the database both in SQLite and MS SQL. Happens both with setup and recipe execution. It's not clear yet if the problem is caused by a single recipe's migrations or if enabling multiple recipes in the same step causes a race condition. I will investigate further, but any suggestions are welcome.

Orchard Core version

The current latest preview at the time of writing this (2.0.0-preview-18246), also the current main as-is.

To Reproduce

Steps to reproduce the behavior:

  1. Clone the latest main.
  2. Set up a new site (any recipe, but make sure deployments feature is enabled)
  3. Go to Admin > Configuration > Import/Export > JSON Import.
  4. Paste the JSON below and submit.
  5. Import succeeds.
  6. Reload the page or navigate to anywhere on the site.
  7. Observe that every page load turns into the error on the screenshot. Restarting the server does not fix the issue.

Recipe JSON to import (these are the features step of the setup recipe of the UI test where I first encountered the problem. I will update this if I can simplify the reproducing recipe):

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "OrchardCore.ContentFields",
        "OrchardCore.ContentFields.Indexing.SQL",
        "OrchardCore.ContentFields.Indexing.SQL.UserPicker",
        "OrchardCore.ContentLocalization",
        "OrchardCore.ContentLocalization.ContentCulturePicker",
        "OrchardCore.ContentLocalization.Sitemaps",
        "OrchardCore.ContentPreview",
        "OrchardCore.ContentTypes",
        "OrchardCore.Contents",
        "OrchardCore.Contents.Deployment.AddToDeploymentPlan",
        "OrchardCore.Contents.Deployment.Download",
        "OrchardCore.Contents.Deployment.ExportContentToDeploymentTarget",
        "OrchardCore.Cors",
        "OrchardCore.CustomSettings",
        "OrchardCore.Deployment.Remote",
        "OrchardCore.Email",
        "OrchardCore.Facebook",
        "OrchardCore.Facebook.Widgets",
        "OrchardCore.Feeds",
        "OrchardCore.Flows",
        "OrchardCore.Forms",
        "OrchardCore.Google.Analytics",
        "OrchardCore.Google.TagManager",
        "OrchardCore.HealthChecks",
        "OrchardCore.Html",
        "OrchardCore.Https",
        "OrchardCore.Indexing",
        "OrchardCore.Layers",
        "OrchardCore.Liquid",
        "OrchardCore.Lists",
        "OrchardCore.Localization.ContentLanguageHeader",
        "OrchardCore.Markdown",
        "OrchardCore.Media",
        "OrchardCore.Media.Cache",
        "OrchardCore.Menu",
        "OrchardCore.OpenId",
        "OrchardCore.OpenId.Client",
        "OrchardCore.OpenId.Management",
        "OrchardCore.OpenId.Server",
        "OrchardCore.OpenId.Validation"
      ]
    }
  ]
}

Note: Also tested this with SQL Server on our own repo

Expected behavior

Site should not break.

Logs and screenshots

After import:
image

After restarting the server:
image

The App_Data log:
orchard-log-2024-06-19.log

Error in SQL Server (UI test in a different repo):
image

@gvkries
Copy link
Contributor

gvkries commented Jun 19, 2024

At first I had the feeling this could be caused by #15793, but it actually looks like a STJ problem. The Facebook widgets migration fails:

OrchardCore.Data.Migration.DataMigrationManager: Error: Error while running migration version 0 for 'OrchardCore.Facebook.Widgets'.

System.Text.Json.JsonException: The JSON value could not be converted to System.String[]. Path: $.categories | LineNumber: 8 | BytePositionInLine: 18.
   at System.Text.Json.ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken)
   at OrchardCore.Recipes.Services.RecipeReader.GetRecipeDescriptorAsync(String recipeBasePath, IFileInfo recipeFileInfo, IFileProvider recipeFileProvider) in C:\Users\georg\Documents\Projects\OrchardCoreWork\src\OrchardCore\OrchardCore.Recipes.Core\Services\RecipeReader.cs:line 15
   at OrchardCore.Recipes.Services.RecipeMigrator.ExecuteAsync(String recipeFileName, IDataMigration migration) in C:\Users\georg\Documents\Projects\OrchardCoreWork\src\OrchardCore\OrchardCore.Recipes.Core\Services\RecipeMigrator.cs:line 47
   at OrchardCore.Facebook.Widgets.WidgetMigrations.CreateAsync() in C:\Users\georg\Documents\Projects\OrchardCoreWork\src\OrchardCore.Modules\OrchardCore.Facebook\Widgets\WidgetMigrations.cs:line 30
   at OrchardCore.Data.Migration.DataMigrationManager.InvokeMethodAsync(MethodInfo method, IDataMigration migration) in C:\Users\georg\Documents\Projects\OrchardCoreWork\src\OrchardCore\OrchardCore.Data.YesSql\Migration\DataMigrationManager.cs:line 254
   at OrchardCore.Data.Migration.DataMigrationManager.UpdateAsync(String featureId) in C:\Users\georg\Documents\Projects\OrchardCoreWork\src\OrchardCore\OrchardCore.Data.YesSql\Migration\DataMigrationManager.cs:line 216
'OrchardCore.Cms.Web.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\8.0.5\Microsoft.AspNetCore.Diagnostics.HealthChecks.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'OrchardCore.Cms.Web.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.5\System.Formats.Asn1.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

@Piedone Piedone added this to the 2.0 milestone Jun 19, 2024
Copy link
Contributor

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.

@sarahelsaig
Copy link
Contributor Author

Turns out the problem is specifically with the data migration in OrchardCore.Facebook.Widgets. What's interesting though is that enabling just that module separately don't completely break the database. So perhaps it triggers some kind of cascading DB corruption?

@Piedone
Copy link
Member

Piedone commented Jun 19, 2024

Important for repro that you have to visit pages on the frontend. I can't repro just by looking around on the admin, including content editors, but opening the Blog Post of the Blog recipe surfaces it.

All the errors in the issue seem like a concurrency issue during recipe import that we recently fixed: #15942. Setting YesSqlOptions.EnableThreadSafetyChecks surfaces such issues, and if I enable it, I get:

System.InvalidOperationException: Two concurrent threads have been detected accessing the same ISession instance from: 
   at System.Environment.get_StackTrace()
   at YesSql.Session.EnterAsyncExecution()
   at YesSql.Session.SaveChangesAsync()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at YesSql.Session.SaveChangesAsync()
   at OrchardCore.Data.Documents.DocumentStore.CommitAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Data.YesSql\Documents\DocumentStore.cs:line 121
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.Data.Documents.DocumentStore.CommitAsync()
   at Microsoft.Extensions.DependencyInjection.OrchardCoreBuilderExtensions.<>c.<AddDataAccess>b__0_4(ShellScope scope) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Data.YesSql\OrchardCoreBuilderExtensions.cs:line 161
   at OrchardCore.Environment.Shell.Scope.ShellScope.BeforeDisposeAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 457
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.Environment.Shell.Scope.ShellScope.BeforeDisposeAsync()
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 305
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 59
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext)
   at OrchardCore.Modules.PoweredByMiddleware.Invoke(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\PoweredByMiddleware.cs:line 27
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
   at Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware.Invoke(HttpContext context)
   at Microsoft.WebTools.BrowserLink.Net.BrowserLinkMiddleware.InvokeAsync(HttpContext context)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at Microsoft.WebTools.BrowserLink.Net.BrowserLinkMiddleware.GetScriptTag(String requestId, Boolean isHttps, String hostUrl)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Net.Sockets.SocketAsyncEventArgs.<>c.<.cctor>b__173_0(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading.ThreadPoolTypedWorkItemQueue`2.System.Threading.IThreadPoolWorkItem.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
and:
   at System.Environment.get_StackTrace()
   at YesSql.Session.EnterAsyncExecution()
   at YesSql.Services.DefaultQuery.Query`1.ListImpl()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at YesSql.Services.DefaultQuery.Query`1.ListImpl()
   at YesSql.Services.DefaultQuery.QueryIndex`1.YesSql.IQueryIndex<T>.ListAsync()
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.InitializeEntriesAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\LocalizationEntries.cs:line 195
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.InitializeEntriesAsync()
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.EnsureInitializedAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\LocalizationEntries.cs:line 71
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.EnsureInitializedAsync()
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.TryGetLocalizationAsync(String contentItemId) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\LocalizationEntries.cs:line 37
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.TryGetLocalizationAsync(String contentItemId)
   at OrchardCore.ContentLocalization.Services.ContentCulturePickerService.GetLocalizationFromRouteAsync(PathString url) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\ContentCulturePickerService.cs:line 76
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.ContentLocalization.Services.ContentCulturePickerService.GetLocalizationFromRouteAsync(PathString url)
   at OrchardCore.ContentLocalization.ContentRequestCultureProvider.DetermineProviderCultureResult(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\ContentRequestCultureProvider.cs:line 23
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.ContentLocalization.ContentRequestCultureProvider.DetermineProviderCultureResult(HttpContext httpContext)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at OrchardCore.Security.Services.SecurityHeadersMiddleware.Invoke(HttpContext context) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.Security\Services\SecurityHeadersMiddleware.cs:line 30
   at Microsoft.Extensions.DependencyInjection.OrchardCoreBuilderExtensions.<>c.<AddBackgroundService>b__5_2(HttpContext context, RequestDelegate next) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\Extensions\OrchardCoreBuilderExtensions.cs:line 116
   at OrchardCore.Diagnostics.DiagnosticsStartupFilter.<>c__DisplayClass3_0.<<Configure>b__1>d.MoveNext() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.Diagnostics\DiagnosticsStartupFilter.cs:line 34
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.Diagnostics.DiagnosticsStartupFilter.<>c__DisplayClass3_0.<Configure>b__1(HttpContext context, Func`1 next)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at OrchardCore.ContentPreview.PreviewStartupFilter.<>c.<<Configure>b__0_1>d.MoveNext() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentPreview\PreviewStartupFilter.cs:line 16
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.ContentPreview.PreviewStartupFilter.<>c.<Configure>b__0_1(HttpContext context, Func`1 next)
   at OrchardCore.Modules.ShellRequestPipeline.Invoke(Object context) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Modules\ShellRequestPipeline.cs:line 10
   at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantRouterMiddleware.cs:line 47
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext)
   at OrchardCore.Modules.ModularTenantContainerMiddleware.<>c__DisplayClass4_0.<<Invoke>b__0>d.MoveNext() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 61
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.Modules.ModularTenantContainerMiddleware.<>c__DisplayClass4_0.<Invoke>b__0(ShellScope scope)
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 291
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 59
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext)
   at OrchardCore.Modules.PoweredByMiddleware.Invoke(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\PoweredByMiddleware.cs:line 27
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
   at Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware.Invoke(HttpContext context)
   at Microsoft.WebTools.BrowserLink.Net.BrowserLinkMiddleware.InvokeAsync(HttpContext context)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at Microsoft.WebTools.BrowserLink.Net.BrowserLinkMiddleware.GetScriptTag(String requestId, Boolean isHttps, String hostUrl)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Net.Sockets.SocketAsyncEventArgs.<>c.<.cctor>b__173_0(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading.ThreadPoolTypedWorkItemQueue`2.System.Threading.IThreadPoolWorkItem.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
---
   at YesSql.Session.EnterAsyncExecution()
   at YesSql.Session.SaveChangesAsync()
   at OrchardCore.Data.Documents.DocumentStore.CommitAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Data.YesSql\Documents\DocumentStore.cs:line 121
   at OrchardCore.Environment.Shell.Scope.ShellScope.BeforeDisposeAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 457
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 305
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 307
   at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 59
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)    at YesSql.Session.EnterAsyncExecution()
   at YesSql.Session.SaveChangesAsync()
   at OrchardCore.Data.Documents.DocumentStore.CommitAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Data.YesSql\Documents\DocumentStore.cs:line 121
   at OrchardCore.Environment.Shell.Scope.ShellScope.BeforeDisposeAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 457
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 305
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 307
   at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 59
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

The Facebook migration issue might be the root cause though, cascading into the the rest. I get this in the logs BTW if I DON'T set EnableThreadSafetyChecks:

2024-06-19 16:49:45.1130|Default|00-9f1af7262f13c341e027f8690ad55972-fd76a239826a628c-00||OrchardCore.Data.Migration.DataMigrationManager|ERROR|Error while running migration version 0 for 'OrchardCore.Facebook.Widgets'. System.Text.Json.JsonException: The JSON value could not be converted to System.String[]. Path: $.categories | LineNumber: 8 | BytePositionInLine: 18.
   at System.Text.Json.ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken)
   at OrchardCore.Recipes.Services.RecipeReader.GetRecipeDescriptorAsync(String recipeBasePath, IFileInfo recipeFileInfo, IFileProvider recipeFileProvider) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Recipes.Core\Services\RecipeReader.cs:line 15
   at OrchardCore.Recipes.Services.RecipeMigrator.ExecuteAsync(String recipeFileName, IDataMigration migration) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Recipes.Core\Services\RecipeMigrator.cs:line 47
   at OrchardCore.Facebook.Widgets.WidgetMigrations.CreateAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.Facebook\Widgets\WidgetMigrations.cs:line 30
   at OrchardCore.Data.Migration.DataMigrationManager.InvokeMethodAsync(MethodInfo method, IDataMigration migration) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Data.YesSql\Migration\DataMigrationManager.cs:line 254
   at OrchardCore.Data.Migration.DataMigrationManager.UpdateAsync(String featureId) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Data.YesSql\Migration\DataMigrationManager.cs:line 216    at System.Text.Json.ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken)
   at OrchardCore.Recipes.Services.RecipeReader.GetRecipeDescriptorAsync(String recipeBasePath, IFileInfo recipeFileInfo, IFileProvider recipeFileProvider) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Recipes.Core\Services\RecipeReader.cs:line 15
   at OrchardCore.Recipes.Services.RecipeMigrator.ExecuteAsync(String recipeFileName, IDataMigration migration) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Recipes.Core\Services\RecipeMigrator.cs:line 47
   at OrchardCore.Facebook.Widgets.WidgetMigrations.CreateAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.Facebook\Widgets\WidgetMigrations.cs:line 30
   at OrchardCore.Data.Migration.DataMigrationManager.InvokeMethodAsync(MethodInfo method, IDataMigration migration) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Data.YesSql\Migration\DataMigrationManager.cs:line 254
   at OrchardCore.Data.Migration.DataMigrationManager.UpdateAsync(String featureId) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Data.YesSql\Migration\DataMigrationManager.cs:line 216
2024-06-19 16:49:50.5714|Default|00-39b87bd40b06a0dc01bef118e22634db-dbcc6ca4cf4ff45b-00|1|Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware|ERROR|An unhandled exception has occurred while executing the request. Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such table: LocalizedContentItemIndex'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 434
   at YesSql.Store.<>c__DisplayClass44_0`2.<<ProduceAwaitedAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at YesSql.Data.WorkDispatcher`2.ScheduleAsync[TState](TKey key, TState state, Func`3 valueFactory)
   at YesSql.Store.ProduceAwaitedAsync[T,TState](WorkerQueryKey key, Func`3 work, TState state)
   at YesSql.Services.DefaultQuery.Query`1.ListImpl()
   at YesSql.Services.DefaultQuery.Query`1.ListImpl()
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.InitializeEntriesAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\LocalizationEntries.cs:line 195
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.EnsureInitializedAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\LocalizationEntries.cs:line 71
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.TryGetLocalizationAsync(String contentItemId) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\LocalizationEntries.cs:line 37
   at OrchardCore.ContentLocalization.Services.ContentCulturePickerService.GetLocalizationFromRouteAsync(PathString url) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\ContentCulturePickerService.cs:line 76
   at OrchardCore.ContentLocalization.ContentRequestCultureProvider.DetermineProviderCultureResult(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\ContentRequestCultureProvider.cs:line 23
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at OrchardCore.Diagnostics.DiagnosticsStartupFilter.<>c__DisplayClass3_0.<<Configure>b__1>d.MoveNext() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.Diagnostics\DiagnosticsStartupFilter.cs:line 34
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at OrchardCore.ContentPreview.PreviewStartupFilter.<>c.<<Configure>b__0_1>d.MoveNext() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentPreview\PreviewStartupFilter.cs:line 16
--- End of stack trace from previous location ---
   at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantRouterMiddleware.cs:line 47
   at OrchardCore.Modules.ModularTenantContainerMiddleware.<>c__DisplayClass4_0.<<Invoke>b__0>d.MoveNext() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 61
--- End of stack trace from previous location ---
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 291
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 296
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 301
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 306
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 307
   at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 59
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)    at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 434
   at YesSql.Store.<>c__DisplayClass44_0`2.<<ProduceAwaitedAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at YesSql.Data.WorkDispatcher`2.ScheduleAsync[TState](TKey key, TState state, Func`3 valueFactory)
   at YesSql.Store.ProduceAwaitedAsync[T,TState](WorkerQueryKey key, Func`3 work, TState state)
   at YesSql.Services.DefaultQuery.Query`1.ListImpl()
   at YesSql.Services.DefaultQuery.Query`1.ListImpl()
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.InitializeEntriesAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\LocalizationEntries.cs:line 195
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.EnsureInitializedAsync() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\LocalizationEntries.cs:line 71
   at OrchardCore.ContentLocalization.Services.LocalizationEntries.TryGetLocalizationAsync(String contentItemId) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\LocalizationEntries.cs:line 37
   at OrchardCore.ContentLocalization.Services.ContentCulturePickerService.GetLocalizationFromRouteAsync(PathString url) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\Services\ContentCulturePickerService.cs:line 76
   at OrchardCore.ContentLocalization.ContentRequestCultureProvider.DetermineProviderCultureResult(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentLocalization\ContentRequestCultureProvider.cs:line 23
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at OrchardCore.Diagnostics.DiagnosticsStartupFilter.<>c__DisplayClass3_0.<<Configure>b__1>d.MoveNext() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.Diagnostics\DiagnosticsStartupFilter.cs:line 34
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at OrchardCore.ContentPreview.PreviewStartupFilter.<>c.<<Configure>b__0_1>d.MoveNext() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore.Modules\OrchardCore.ContentPreview\PreviewStartupFilter.cs:line 16
--- End of stack trace from previous location ---
   at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantRouterMiddleware.cs:line 47
   at OrchardCore.Modules.ModularTenantContainerMiddleware.<>c__DisplayClass4_0.<<Invoke>b__0>d.MoveNext() in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 61
--- End of stack trace from previous location ---
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 291
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 296
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 301
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 306
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 307
   at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) in E:\Projects\OrchardForks\OrchardCore7\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 59
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

@Piedone
Copy link
Member

Piedone commented Jun 19, 2024

I looked into the multi-threading issue, but don't see how that happens, yet. Once the app reaches this faulted state, it stays in it, so every page load throws the exception, so easy to observe, However, one thread supposedly starts around here, and on page reloads, this isn't even called.

My hunch is that an ISession instance is mistakenly carried across scope boundaries or something.

@sarahelsaig
Copy link
Contributor Author

I think we get this "Two concurrent threads" error when using SQL Server, because OC is trying to re-run the failed migration for every new web request (apparently in a separate thread that's not awaited?), as if the program just started up.

@Piedone
Copy link
Member

Piedone commented Jun 19, 2024

Ah, that may be it.

@gvkries
Copy link
Contributor

gvkries commented Jun 20, 2024

Shouldn't we be more careful to ensure that the database doesn't break in the event of a single failed migration?

@Piedone
Copy link
Member

Piedone commented Jun 20, 2024

Yep: #16354

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

Successfully merging a pull request may close this issue.

3 participants