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

V13 RC: Installing throws an error if using SQLite as the DB #15090

Closed
warrenbuckley opened this issue Nov 1, 2023 · 44 comments
Closed

V13 RC: Installing throws an error if using SQLite as the DB #15090

warrenbuckley opened this issue Nov 1, 2023 · 44 comments
Assignees
Labels
affected/v12 affected/v13 release/12.3.4 state/needs-investigation This requires input from HQ or community to proceed state/needs-reproduction Check if this can be reproduced in the latest released version state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks type/bug

Comments

@warrenbuckley
Copy link
Contributor

warrenbuckley commented Nov 1, 2023

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

13.0.0-rc1

Bug summary

I am going through the normal installer flow running from my local machine via the command line (kestrel) running on Windows 11 and get an error after the database steps try to install.

Specifics

Error in installer flow
image

Logs (During install)
UmbracoTraceLog.HACKMAKEDO.20231101.json

And a subsequent run with dotnet run I get the following error
no such table: umbracoOpenIddictApplications

[14:59:04 INF] Acquiring MainDom.
[14:59:04 INF] Acquired MainDom.
[14:59:05 WRN] Database NuCache was serialized using 0. Currently configured NuCache serializer MessagePack. Rebuilding Nucache
[14:59:05 INF] Rebuilding NuCache database with MessagePack serializer [Timing a6890f4]
[14:59:05 INF] Completed. (154ms) [Timing a6890f4]
[14:59:05 WRN] No last synced Id found, this generally means this is a new server/install. A cold boot will be triggered.
[Unhandled exception. 14:59:05 ERR] Unhandled exception in AppDomain (terminating).
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such table: umbracoOpenIddictApplications'.Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such table: umbracoOpenIddictApplications'.
   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 Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at OpenIddict.EntityFrameworkCore.OpenIddictEntityFrameworkCoreApplicationStore`5.FindByClientIdAsync(String identifier, CancellationToken cancellationToken)   at OpenIddict.Core.OpenIddictApplicationCache`1.<>c__DisplayClass6_0.<<FindByClientIdAsync>g__ExecuteAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
   at OpenIddict.Core.OpenIddictApplicationManager`1.FindByClientIdAsync(String identifier, CancellationToken cancellationToken)
   at OpenIddict.Core.OpenIddictApplicationManager`1.OpenIddict.Abstractions.IOpenIddictApplicationManager.FindByClientIdAsync(String identifier, CancellationToken cancellationToken)
   at Umbraco.Cms.Infrastructure.Security.OpenIdDictApplicationManagerBase.Delete(String identifier, CancellationToken cancellationToken)
   at Umbraco.Cms.Api.Delivery.Security.MemberApplicationManager.DeleteMemberApplicationAsync(CancellationToken cancellationToken)
   at Umbraco.Cms.Api.Delivery.Handlers.InitializeMemberApplicationNotificationHandler.HandleAsync(UmbracoApplicationStartingNotification notification, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.INotificationAsyncHandler`1.HandleAsync(IEnumerable`1 notifications, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishCoreAsync[TNotification](IEnumerable`1 allHandlers, IEnumerable`1 notifications, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.NotificationAsyncHandlerWrapperImpl`1.HandleAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken, ServiceFactory serviceFactory, Func`4 publish)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishNotificationsAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken)   at Umbraco.Cms.Core.Events.EventAggregator.PublishAsync[TNotification](TNotification notification, CancellationToken cancellationToken)
   at Umbraco.Cms.Infrastructure.Runtime.CoreRuntime.StartAsync(CancellationToken cancellationToken, Boolean isRestarting)
   at Umbraco.Cms.Infrastructure.Runtime.CoreRuntime.StartAsync(CancellationToken cancellationToken)
   at Umbraco.Extensions.WebApplicationExtensions.BootUmbracoAsync(WebApplication app)
   at Program.<Main>$(String[] args) in D:\Code\HackMakeDo\UmbracoV13Playground\Program.cs:line 12
   at Program.<Main>(String[] args)

   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 Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at OpenIddict.EntityFrameworkCore.OpenIddictEntityFrameworkCoreApplicationStore`5.FindByClientIdAsync(String identifier, CancellationToken cancellationToken)   at OpenIddict.Core.OpenIddictApplicationCache`1.<>c__DisplayClass6_0.<<FindByClientIdAsync>g__ExecuteAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
   at OpenIddict.Core.OpenIddictApplicationManager`1.FindByClientIdAsync(String identifier, CancellationToken cancellationToken)
   at OpenIddict.Core.OpenIddictApplicationManager`1.OpenIddict.Abstractions.IOpenIddictApplicationManager.FindByClientIdAsync(String identifier, CancellationToken cancellationToken)
   at Umbraco.Cms.Infrastructure.Security.OpenIdDictApplicationManagerBase.Delete(String identifier, CancellationToken cancellationToken)
   at Umbraco.Cms.Api.Delivery.Security.MemberApplicationManager.DeleteMemberApplicationAsync(CancellationToken cancellationToken)
   at Umbraco.Cms.Api.Delivery.Handlers.InitializeMemberApplicationNotificationHandler.HandleAsync(UmbracoApplicationStartingNotification notification, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.INotificationAsyncHandler`1.HandleAsync(IEnumerable`1 notifications, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishCoreAsync[TNotification](IEnumerable`1 allHandlers, IEnumerable`1 notifications, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.NotificationAsyncHandlerWrapperImpl`1.HandleAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken, ServiceFactory serviceFactory, Func`4 publish)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishNotificationsAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken)   at Umbraco.Cms.Core.Events.EventAggregator.PublishAsync[TNotification](TNotification notification, CancellationToken cancellationToken)
   at Umbraco.Cms.Infrastructure.Runtime.CoreRuntime.StartAsync(CancellationToken cancellationToken, Boolean isRestarting)
   at Umbraco.Cms.Infrastructure.Runtime.CoreRuntime.StartAsync(CancellationToken cancellationToken)
   at Umbraco.Extensions.WebApplicationExtensions.BootUmbracoAsync(WebApplication app)
   at Program.<Main>$(String[] args) in D:\Code\HackMakeDo\UmbracoV13Playground\Program.cs:line 12
   at Program.<Main>(String[] args)

dotnet --list-sdks
image

7.0.310 [C:\Program Files\dotnet\sdk]
7.0.403 [C:\Program Files\dotnet\sdk]
8.0.100-rc.2.23502.2 [C:\Program Files\dotnet\sdk]

Steps to reproduce

  • Installed dotnet new templates dotnet new install Umbraco.Templates::13.0.0-rc1
  • Created a new project using dotnet new umbraco -n UmbracoV13Playground
  • dotnet run
  • Filled out Name, email & password
  • Kept all the other stuff as is (so SQLite)
  • KABOOM error (see attached)

Expected result / actual result

No response


This item has been added to our backlog AB#35142

@warrenbuckley warrenbuckley changed the title V13 RC: Installing throws an error V13 RC: Installing throws an error if using SQLite as the DB Nov 1, 2023
@kjac kjac self-assigned this Nov 3, 2023
@kjac
Copy link
Contributor

kjac commented Nov 3, 2023

Hi @warrenbuckley,

Thanks for reaching out 👍

I can't really reproduce this 😕 the exact same steps work fine on my machine. No KABOOM here. I even tried RC1 and RC2 of .NET8 (definitively because I am so thorough, not at all becourse I had RC1 installed when I first ran the test 🤦).

From what I can read in the attached logfile, everything runs fine until EF Core tries to run its migrations. Then... KABOOM. I wonder why that does not happen on my end.

Can you reproduce this error?

@kjac kjac added state/needs-investigation This requires input from HQ or community to proceed state/needs-reproduction Check if this can be reproduced in the latest released version affected/v13 labels Nov 3, 2023
@kjac
Copy link
Contributor

kjac commented Nov 3, 2023

Update: @enkelmedia also ran into this (#15125). Still can't reproduce it myself. I will make sure the whole team makes an attempt at a fresh install from the templates early next week, in the hope that someone can reproduce.

@warrenbuckley
Copy link
Contributor Author

@kjac I have not been able to reproduce the error and I would check to see if @enkelmedia still can, as after a reboot of my machine it all worked fine.

@KevinJump also had the same issue but prompted me to do a reboot as his issue went away and so did mine after that.
https://discord.com/channels/869656431308189746/1169295860325158963

Kenn, I wonder if a Windows patch or VS or .NET update was out that day as well that needed to be applied perhaps, as super odd just after a reboot it all got fixed up.

@kjac
Copy link
Contributor

kjac commented Nov 6, 2023

@warrenbuckley thanks for the update. I have been wondering the same ... I just don't feel comfortable with things magically fixing themselves 🤔 on the other hand, we we can't reproduce this after rebooting - well, then we can't.

I'm still going to make sure the team has a go at this. If the reboot theory sticks, they shouldn't be able to reproduce either 😝

@enkelmedia
Copy link
Contributor

I just restarted my computer and tried again - did not solve the problem.

One or more errors occurred. (One or more errors occurred. (Cannot access a disposed object. Object name: 'IServiceProvider'.))

See the log for full details (logs can typically be found in the umbraco\Logs folder).
{
  "@t": "2023-11-06T09:09:10.6062842Z",
  "@mt": "An error occurred during installation step {Step}",
  "@l": "Error",
  "@x": "System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.\r\n ---> System.AggregateException: One or more errors occurred. (One or more errors occurred. (Cannot access a disposed object.\r\nObject name: 'IServiceProvider'.))\r\n ---> System.AggregateException: One or more errors occurred. (Cannot access a disposed object.\r\nObject name: 'IServiceProvider'.)\r\n ---> System.ObjectDisposedException: Cannot access a disposed object.\r\nObject name: 'IServiceProvider'.\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ThrowHelper.ThrowObjectDisposedException()\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)\r\n   at Microsoft.EntityFrameworkCore.Infrastructure.Internal.InfrastructureExtensions.GetService(IInfrastructure`1 accessor, Type serviceType)\r\n   at Microsoft.EntityFrameworkCore.Infrastructure.Internal.InfrastructureExtensions.GetService[TService](IInfrastructure`1 accessor)\r\n   at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure`1 accessor)\r\n   at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.get_Dependencies()\r\n   at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.get_CurrentTransaction()\r\n   at Umbraco.Cms.Persistence.EFCore.Sqlite.SqliteMigrationProvider.MigrateAllAsync()\r\n   at Umbraco.Cms.Persistence.EFCore.EfCoreMigrationExecutor.ExecuteAllMigrationsAsync()\r\n   at Umbraco.Cms.Persistence.EFCore.Composition.EFCoreCreateTablesNotificationHandler.HandleAsync()\r\n   at Umbraco.Cms.Persistence.EFCore.Composition.EFCoreCreateTablesNotificationHandler.HandleAsync(DatabaseSchemaAndDataCreatedNotification notification, CancellationToken cancellationToken)\r\n   at Umbraco.Cms.Core.Events.INotificationAsyncHandler`1.HandleAsync(IEnumerable`1 notifications, CancellationToken cancellationToken)\r\n   at Umbraco.Cms.Core.Events.EventAggregator.PublishCoreAsync[TNotification](IEnumerable`1 allHandlers, IEnumerable`1 notifications, CancellationToken cancellationToken)\r\n   at Umbraco.Cms.Core.Events.NotificationAsyncHandlerWrapperImpl`1.HandleAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken, ServiceFactory serviceFactory, Func`4 publish)\r\n   at Umbraco.Cms.Core.Events.EventAggregator.PublishNotificationsAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken)\r\n   --- End of inner exception stack trace ---\r\n   at System.Threading.Tasks.Task.WaitAllCore(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)\r\n   at System.Threading.Tasks.Task.WaitAll(Task[] tasks)\r\n   at Umbraco.Cms.Core.Events.EventAggregator.Publish[TNotification,TNotificationHandler](IEnumerable`1 notifications)\r\n   at Umbraco.Cms.Core.Events.ScopedNotificationPublisher`1.PublishScopedNotifications(IList`1 notifications)\r\n   at Umbraco.Cms.Core.Events.ScopedNotificationPublisher`1.ScopeExit(Boolean completed)\r\n   at Umbraco.Cms.Core.Scoping.CoreScope.HandleScopedNotifications()\r\n   at Umbraco.Cms.Infrastructure.Scoping.Scope.TryFinally(Action[] actions)\r\n   --- End of inner exception stack trace ---\r\n   at Umbraco.Cms.Infrastructure.Scoping.Scope.TryFinally(Action[] actions)\r\n   at Umbraco.Cms.Infrastructure.Scoping.Scope.RobustExit(Boolean completed, Boolean onException)\r\n   at Umbraco.Cms.Infrastructure.Scoping.Scope.DisposeLastScope()\r\n   at Umbraco.Cms.Infrastructure.Scoping.Scope.Dispose()\r\n   at Umbraco.Cms.Infrastructure.Migrations.Install.DatabaseBuilder.CreateSchemaAndData()\r\n   at Umbraco.Cms.Infrastructure.Install.InstallSteps.DatabaseInstallStep.ExecuteAsync(Object model)\r\n   at InvokeStub_InstallSetupStep`1.ExecuteAsync(Object, Span`1)\r\n   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n   --- End of inner exception stack trace ---\r\n   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)\r\n   at Umbraco.Cms.Web.BackOffice.Install.InstallApiController.ExecuteStepAsync(InstallSetupStep step, Object instruction)\r\n   at Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall(InstallInstructions installModel)",
  "Step": "DatabaseInstall",
  "SourceContext": "Umbraco.Cms.Web.BackOffice.Install.InstallApiController",
  "ActionId": "80b4a6f4-9def-4971-a548-c575ceff10f3",
  "ActionName": "Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall (Umbraco.Web.BackOffice)",
  "RequestId": "0HMUUKVVV23BI:00000005",
  "RequestPath": "/install/api/PostPerformInstall",
  "ConnectionId": "0HMUUKVVV23BI",
  "ProcessId": 24532,
  "ProcessName": "MyUmb13Test",
  "ThreadId": 6,
  "ApplicationId": "ecec7485f57c871a2250d4a648dc9f59b5898ac2",
  "MachineName": "EM-FRACTAL",
  "Log4NetLevel": "ERROR",
  "HttpRequestId": "41c454f4-2d21-4a06-8d36-50bdc7a91d59",
  "HttpRequestNumber": 1,
  "HttpSessionId": "2c7eb55a-eae6-4f0f-2c64-40e72babb339"
}

After stopping the site and doing dotnet run again i get this error

Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such table: umbracoOpenIddictApplications'.
   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 Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at OpenIddict.EntityFrameworkCore.OpenIddictEntityFrameworkCoreApplicationStore`5.FindByClientIdAsync(String identifier, CancellationToken cancellationToken)
   at OpenIddict.Core.OpenIddictApplicationCache`1.<>c__DisplayClass6_0.<<FindByClientIdAsync>g__ExecuteAsync|0>d.MoveNext()

SDK: 8.0.100-rc.2.23502.2
Platform: Windows 11 Pro
Db: SQLite

@warrenbuckley
Copy link
Contributor Author

That is weird as myself and Kevin it just went away?!
@enkelmedia a suggestion try, is to clear your nuget cache and see if any pending updates from Visual Studio or Windows updates would be what I would try myself next.

dotnet nuget locals all --clear

For OS Comparison if that is of any help/use

Edition	Windows 11 Pro
Version	22H2
Installed on	‎21/‎06/‎2023
OS build	22621.2506
Experience	Windows Feature Experience Pack 1000.22677.1000.0

@enkelmedia
Copy link
Contributor

enkelmedia commented Nov 8, 2023

FYI: I just made a clean install of 12.3.1 using SQLite and got the same error.

@kjac Update here, same issue on the officially released 12.3.1 version. I have the same error both on my computer at home and at the office. Both Windows 11 Pro. Intel.

@warrenbuckley I'll get back with the details.

EDIT:

Downgraded to 12.2.0 and installed without problems.

Edition	Windows 11 Pro
Version	22H2
Installed on	‎2023-‎01-‎27
OS build	22621.2428
Experience	Windows Feature Experience Pack 1000.22674.1000.0

I'll see if an OS upgrade solve the issue.

Edit2:

Still no luck.

Updated Visual Studio to latest versions:

17.7.1
Preview 17.8.0 Preview 7.0

And the OS:

Edition	Windows 11 Pro
Version	23H2
Installed on	‎2023-‎01-‎27
OS build	22631.2428
Experience	Windows Feature Experience Pack 1000.22674.1000.0

Edit3:
Looking closer at the logs.

Might be something with the EF Core-implementation? Looks like the connection-string change makes the UmbracoDbContext dispose, next after this comes the error.

image

One or more errors occurred. (One or more errors occurred. (Cannot access a disposed object. Object name: 'IServiceProvider'.))

Edit4:
Also tried:

dotnet nuget locals all --clear

Still the same error during install.

@dan-hammond
Copy link

The same is happening for me on a Mac with a fresh 12.3.1 project, as well as my existing projects I updated from 12.2.0 to 12.3.1.

@kjac
Copy link
Contributor

kjac commented Nov 10, 2023

Thanks @dan-hammond ... we're investigating, gotta get to the bottom of this.

@kjac kjac assigned Migaroez and unassigned kjac Nov 10, 2023
@Migaroez
Copy link
Contributor

hey @enkelmedia I have been trying to reproduce this all morning to no avail, could you send me your full log files from the failed install? sge@umbraco.dk

@KevinJump
Copy link
Contributor

Hi @Migaroez

I've sent you a couple of logs from just now, one with debugging on.

I would say i can currently get the RC1 install to fail around 80% of the time.

@enkelmedia
Copy link
Contributor

@Migaroez I've sent you logs for both Umbraco 12.3.1 and 13.0.0-rc2 where I have these issues. The last version that worked was 12.2.0.

@Eaglef90
Copy link

Eaglef90 commented Nov 13, 2023

I appear to behing this issue as well though I am nto 100% sure if I am on SQLLite right now, reaching out to my host to confirm. For me the upgrade works fine on my local development machine, which connects to the DB on my staging environment but if I publish to staing or production those environemtns will break. Here is the erro I was able to dig up

:\HostingSpaces\ffinfoco\ffinfo.com_1J3tkwT0\wwwroot' hit unexpected managed exception, exception code = '0xe0434352'. First 30KB characters of captured stdout and stderr logs:
Unhandled exception. System.ObjectDisposedException: Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.
Object name: 'UmbracoDbContext'.
   at Microsoft.EntityFrameworkCore.DbContext.CheckDisposed()
   at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Internal.IDbSetCache.GetOrAddSet(IDbSetSource source, Type type)
   at Microsoft.EntityFrameworkCore.DbContext.Set[TEntity]()
   at OpenIddict.EntityFrameworkCore.OpenIddictEntityFrameworkCoreApplicationStore5.get_Applications()
   at OpenIddict.EntityFrameworkCore.OpenIddictEntityFrameworkCoreApplicationStore5.FindByClientIdAsync(String identifier, CancellationToken cancellationToken)
   at OpenIddict.Core.OpenIddictApplicationCache1.<>c__DisplayClass6_0.<<FindByClientIdAsync>g__ExecuteAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
   at OpenIddict.Core.OpenIddictApplicationManager1.FindByClientIdAsync(String identifier, CancellationToken cancellationToken)
   at OpenIddict.Core.OpenIddictApplicationManager`1.OpenIddict.Abstractions.IOpenIddictApplicationManager.FindByClientIdAsync(String identifier, CancellationToken cancellationToken)
   at Umbraco.Cms.Infrastructure.Security.OpenIdDictApplicationManagerBase.Delete(String identifier, CancellationToken cancellationToken)
   at
Umbraco.Cms.Api.Delivery.Security.MemberApplicationManager.DeleteMemberApplicationAsync(CancellationToken cancellationToken)
   at Umbraco.Cms.Api.Delivery.Handlers.InitializeMemberApplicationNotificationHandler.HandleAsync(UmbracoApplicationStartingNotification notification, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.INotificationAsyncHandler1.HandleAsync(IEnumerable1 notifications, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishCoreAsync[TNotification](IEnumerable1 allHandlers, IEnumerable1 notifications, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.NotificationAsyncHandlerWrapperImpl1.HandleAsync[TNotification,TNotificationHandler](IEnumerable1 notifications, CancellationToken cancellationToken, ServiceFactory serviceFactory, Func4 publish)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishNotificationsAsync[TNotification,TNotificationHandler](IEnumerable1 notifications, CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at FFInfo.Program.Main(String[] args) in D:\FFInfo.com Web Site\Program.cs:line 6

I am not good with debuggin but I am willing to give an umbraco dev access to my github and staging environment for testing and debuging.

Just heard back and I am using SQL Server 2019 as a backend DB. So not sure if this is the same problem as those reporting on SQLlite or not.

@Migaroez
Copy link
Contributor

Hey @Eaglef90, this seems to be a similar but not the same issue (i think), they both have to do with Disposed objects that shouldn't be disposed. But the objects are different and you are talking about an upgrade.

They might have the same root cause though. Just to be safe, could you tell me the exact from and to version you are using in the upgrade process?

@Migaroez
Copy link
Contributor

@KevinJump Are you able to reproduce this on the release/13.0 branch?

@Eaglef90
Copy link

@Migaroez I am going from 12.2.0 to 12.3.0

@Migaroez
Copy link
Contributor

@Eaglef90 Could you send me full log files from when the upgrade starts?

@Migaroez
Copy link
Contributor

Migaroez commented Nov 14, 2023

@KevinJump Sanity check time, could you run the following powershell command in a failing test-project/bin/debug/net8.0 folder? and share the results?

Get-ChildItem -Filter Umbraco.*.dll | Select-Object -ExpandProperty VersionInfo | Format-Table -AutoSize

@KevinJump
Copy link
Contributor

Sure..

Hotfix(s):                 7 Hotfix(s) Installed.
                           [01]: KB5030651
                           [02]: KB5032007
                           [03]: KB5012170
                           [04]: KB5027397
                           [05]: KB5032190
                           [06]: KB5031592
                           [07]: KB5032393

@lassefredslund lassefredslund added the state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks label Nov 20, 2023
kjac added a commit that referenced this issue Dec 8, 2023
@kjac
Copy link
Contributor

kjac commented Dec 8, 2023

We finally tracked this one down. PR to fix it in #15410

@Eaglef90
Copy link

With an apparent fix found and v13 set to come out in a few days do we know if this will be included in the final release or will we have to wait for a patch version?

@bergmania
Copy link
Member

It will be part of 13.0.0 and is part of 12.3.4

@marcloveUSN
Copy link

Still not part of 13 :(

@bergmania
Copy link
Member

Hi @marcloveUSN..

The PR is part of 13.0.0, so if you experience exactly the same issue, it must be something else underlying. And in that case, please create a new issue.

Also please ensure you do not have any custom code/ packages that requests a EF Core context, before a connection string is set.

@enkelmedia
Copy link
Contributor

For reference: I had no problem installing 13 on the machine where I had this issue.

@marcloveUSN
Copy link

@bergmania Will open a new issue. Got a feeling this may be to do with the new ability to add a Weight to package migrations in V13.

@creativesuspects
Copy link

I'm still seeing this issue on 13.0.3.

[14:37:50 INF] New table umbracoWebhookRequest was created
[14:37:50 INF] Database configuration status: <p>Installation completed!</p>
[14:37:50 WRN] Connection string changed, disposing context
[14:37:50 ERR] Installation step DatabaseInstall failed.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.AggregateException: One or more errors occurred. (One or more errors occurred. (Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.
Object name: 'UmbracoDbContext'.))
 ---> System.AggregateException: One or more errors occurred. (Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.
Object name: 'UmbracoDbContext'.)
 ---> System.ObjectDisposedException: Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.
Object name: 'UmbracoDbContext'.
   at Microsoft.EntityFrameworkCore.DbContext.CheckDisposed()
   at Microsoft.EntityFrameworkCore.DbContext.get_Database()
   at Umbraco.Cms.Persistence.EFCore.Sqlite.SqliteMigrationProvider.MigrateAllAsync()
   at Umbraco.Cms.Persistence.EFCore.EfCoreMigrationExecutor.ExecuteAllMigrationsAsync()
   at Umbraco.Cms.Persistence.EFCore.Composition.EFCoreCreateTablesNotificationHandler.HandleAsync()
   at Umbraco.Cms.Persistence.EFCore.Composition.EFCoreCreateTablesNotificationHandler.HandleAsync(DatabaseSchemaAndDataCreatedNotification notification, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.INotificationAsyncHandler`1.HandleAsync(IEnumerable`1 notifications, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishCoreAsync[TNotification](IEnumerable`1 allHandlers, IEnumerable`1 notifications, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.NotificationAsyncHandlerWrapperImpl`1.HandleAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken, ServiceFactory serviceFactory, Func`4 publish)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishNotificationsAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.WaitAllCore(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
   at Umbraco.Cms.Core.Events.EventAggregator.Publish[TNotification,TNotificationHandler](IEnumerable`1 notifications)
   at Umbraco.Cms.Core.Events.ScopedNotificationPublisher`1.PublishScopedNotifications(IList`1 notifications)
   at Umbraco.Cms.Core.Events.ScopedNotificationPublisher`1.ScopeExit(Boolean completed)
   at Umbraco.Cms.Core.Scoping.CoreScope.HandleScopedNotifications()
   at Umbraco.Cms.Infrastructure.Scoping.Scope.TryFinally(Action[] actions)
   --- End of inner exception stack trace ---
   at Umbraco.Cms.Infrastructure.Scoping.Scope.TryFinally(Action[] actions)
   at Umbraco.Cms.Infrastructure.Scoping.Scope.RobustExit(Boolean completed, Boolean onException)
   at Umbraco.Cms.Infrastructure.Scoping.Scope.DisposeLastScope()
   at Umbraco.Cms.Infrastructure.Scoping.Scope.Dispose()
   at Umbraco.Cms.Infrastructure.Migrations.Install.DatabaseBuilder.CreateSchemaAndData()
   at Umbraco.Cms.Infrastructure.Install.InstallSteps.DatabaseInstallStep.ExecuteAsync(Object model)
   at InvokeStub_InstallSetupStep`1.ExecuteAsync(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Umbraco.Cms.Web.BackOffice.Install.InstallApiController.ExecuteStepAsync(InstallSetupStep step, Object instruction)
   at Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall(InstallInstructions installModel)

@marcloveUSN Did you already open a new issue?

@bergmania
Copy link
Member

@creativesuspects is this on a plain new project?

It can definitely still happen, if you start up a EF Core context before there is a connection string, this will happen. Ensure non of you code do that when in install mode (and there do not exist a connection string).

What happened in the original bug, was that OpenIddict somewhere in a constructor started a EFCore context. So when a specific service was injected into one of our constructor, a EF core context was created. Instead we now request that service when needed. (d752853#diff-66cee26fd3ce34df24f24410e528403b5b91d48d7e74f82c879dcd3a9bba5a09)

@creativesuspects
Copy link

creativesuspects commented Jan 16, 2024

@bergmania This was on a clean 13.0.3 install without any custom code:

dotnet new install Umbraco.Templates::13.0.3
dotnet new umbraco -n Umbraco.Cms.13x
cd .\Umbraco.Cms.13x\
dotnet build
dotnet run

I open the site and fill out the 'Install Umbraco' screen, hit the 'Install' button and then I get the same error message as the OP.

When I delete the erroneous SQLite database, remove the connection string from appsettings and enable the unattended install (with the same details) the installation process completes without any issues.

I don't know if it helps, but you can download the project below. The zip also contains the erroneous database and logs from immediately after the failed install and a single attempt to load the site afterwards.

https://www.dropbox.com/scl/fi/5vg2cr1zp3xhj2e9oo8ia/Umbraco.Cms.13x.zip?rlkey=2mmixn1prn5ml6e8ud5irhlib&dl=0

@bergmania
Copy link
Member

Hmm.. Seems like another bug yes. Wonder if it would solve it, if DatabaseSchemaAndDataCreatedNotification was published as a cancelable notification, and thereby execute faster.

It seems again like a timing issue, that only his very few,

@creativesuspects
Copy link

Not sure if it helps, but I didn't run into this issue when installing into a SQL Server database.

@niekvanderreest
Copy link
Contributor

niekvanderreest commented Jan 23, 2024

Hi,

I'm running into "Connection string changed, disposing context" warnings after upgrading a project from umbraco 11.5 to 12.3.6, i don't see any errors and functionality seems to be what is was, but the warnings occur running an async task on and efCoreScopeProvider scope.

The project has Hangfire running on the umbraco database, the warnings occur while running a Hangfire job

image

Any idea if this is related, i would like to know the impact before pushing my upgrade to live (project is hosted on Umbraco Cloud)

@bergmania
Copy link
Member

Hi @niekvanderreest

Sounds like your hangfire is booting too early? Please ensure it do not start, before a connection string is set.

As long as you have a connectionstring in your appsettings/environment varable, there should be no risk related to this.

@smarshallsay
Copy link

I get this on 13.0.3 if using SQLite, SQL Server is fine.

To reproduce I delete umbraco folder, delete connectionstrings from config and load webpage to initialise Umbraco install.

@enkelmedia
Copy link
Contributor

enkelmedia commented Jan 29, 2024

I've also got this error now when running Umbraco.Web.UI in the source repository from this commit 860acd7ba18f0d8f8015932bb5c676c0341ec480. The error was shown just after the database-options screen in the setup.

image

After that, I restart the site and get:

An error occurred while starting the application.
SqliteException: SQLite Error 1: 'no such table: umbracoOpenIddictApplications'.
Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(int rc, sqlite3 db)

SqliteException: SQLite Error 1: 'no such table: umbracoOpenIddictApplications'.
Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(int rc, sqlite3 db)
Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements()+MoveNext()
Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
Microsoft.Data.Sqlite.SqliteCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable<T>+AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable<T>+AsyncEnumerator.MoveNextAsync()
System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<TResult>+ConfiguredValueTaskAwaiter.GetResult()
Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync<TSource>(IAsyncEnumerable<TSource> asyncEnumerable, CancellationToken cancellationToken)
Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync<TSource>(IAsyncEnumerable<TSource> asyncEnumerable, CancellationToken cancellationToken)
OpenIddict.EntityFrameworkCore.OpenIddictEntityFrameworkCoreApplicationStore<TApplication, TAuthorization, TToken, TContext, TKey>.FindByClientIdAsync(string identifier, CancellationToken cancellationToken)
System.Threading.Tasks.ValueTask<TResult>.get_Result()

Here is how to reproduce the error:

15090-repo.mp4

@bergmania
Copy link
Member

Hi @enkelmedia.

Thanks for the video, and nice you can reproduce in our codebase. Obviously I can't as it seems to be a timing issue. What I do not really understand is, how your code just executed UmbracoDbContext.ConfigureOptions and bypassed the check string.IsNullOrWhiteSpace(connectionStrings.ConnectionString), and then afterwards call the OnChange om the OptionsMonitor. I'll have to look into the options monitor to understand.

bergmania added a commit that referenced this issue Jan 31, 2024
* Attempt to fix #15090. Save connection string in private variable after setup.

* Do not dispose ef core contexts when if the connectionstring changes.

A Ef core context is protected from creations when no connection string is present. If it changes that single instance will continue with the connection string it was initialized with.

* Clean up

* Review Equals methods
bergmania added a commit that referenced this issue Jan 31, 2024
* Attempt to fix #15090. Save connection string in private variable after setup.

* Do not dispose ef core contexts when if the connectionstring changes.

A Ef core context is protected from creations when no connection string is present. If it changes that single instance will continue with the connection string it was initialized with.

* Clean up

* Review Equals methods

(cherry picked from commit 5146f05)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected/v12 affected/v13 release/12.3.4 state/needs-investigation This requires input from HQ or community to proceed state/needs-reproduction Check if this can be reproduced in the latest released version state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks type/bug
Projects
None yet
Development

No branches or pull requests