Ocationally got exception when login
Describe the bug
After auto setup, home page was good. when login, only happened Ocationally in local and Azure. the same recipe and codes.
Orchard Core version
3.0.0-preview-18817
To Reproduce
Expected behavior
No Error
Logs and screenshots
ECommerce|00-6e6028bf268c99e35d04518434ebbd84-e041c97c6108298c-00|1|Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware|ERROR|An unhandled exception has occurred while executing the request. System.Collections.Generic.KeyNotFoundException: The given key 'OrchardCore.Roles.Models.RolesDocument, OrchardCore.Roles' was not present in the dictionary. at
System.Collections.Concurrent.ConcurrentDictionary`2.ThrowKeyNotFoundException(TKey key) at
System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key) at
YesSql.Services.TypeService.get_Item(String s) at
YesSql.Session.Get[T](IList`1 documents, String collection) at
YesSql.Session.GetAsync[T](Int64[] ids, String collection, CancellationToken cancellationToken) at
YesSql.Session.GetAsync[T](Int64[] ids, String collection, CancellationToken cancellationToken) at
OrchardCore.Workflows.Http.Filters.WorkflowActionFilter.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) at
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) at
Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger) at
OrchardCore.Seo.Services.RobotsMiddleware.Invoke(HttpContext httpContext) at
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at
Lombiq.HelpfulLibraries.OrchardCore.ResourceManagement.ResourceFilterMiddleware.InvokeAsync(HttpContext context) in /home/runner/work/OC_Commerce_Modules/OC_Commerce_Modules/Helpful-Libraries/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterMiddleware.cs:line 69 at
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at
SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, Boolean retry) at
Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at
Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.g__AwaitMatch|10_1(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task matchTask) at
OrchardCore.Diagnostics.DiagnosticsStartupFilter.<>c__DisplayClass3_0.<b__1>d.MoveNext() --- End of stack trace from previous location --- at
Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context) at
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task) at
System.Collections.Concurrent.ConcurrentDictionary`2.ThrowKeyNotFoundException(TKey key) at
System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key) at
YesSql.Services.TypeService.get_Item(String s) at
YesSql.Session.Get[T](IList`1 documents, String collection) at
YesSql.Session.GetAsync[T](Int64[] ids, String collection, CancellationToken cancellationToken) at
YesSql.Session.GetAsync[T](Int64[] ids, String collection, CancellationToken cancellationToken) at
OrchardCore.Workflows.Http.Filters.WorkflowActionFilter.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) at
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) at
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) at
Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger) at
OrchardCore.Seo.Services.RobotsMiddleware.Invoke(HttpContext httpContext) at
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at
Lombiq.HelpfulLibraries.OrchardCore.ResourceManagement.ResourceFilterMiddleware.InvokeAsync(HttpContext context) in /home/runner/work/OC_Commerce_Modules/OC_Commerce_Modules/Helpful-Libraries/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterMiddleware.cs:line 69 at
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at
SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, Boolean retry) at
Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at
Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.g__AwaitMatch|10_1(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task matchTask) at
OrchardCore.Diagnostics.DiagnosticsStartupFilter.<>c__DisplayClass3_0.<b__1>d.MoveNext() --- End of stack trace from previous location --- at
Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context) at
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
Related Issues
- OrchardCMS/OrchardCore#18561: ObjectDisposedException with AutoSetup
- OrchardCMS/OrchardCore#18046: An error occurred stopping the application System.BadImageFormatException: Could not load file or assembly ''. Index not found.
Suggested Issue Assignees
- infofromca
- canadacubachina
Actions
- [ ] 📝 Generate an implementation plan for this issue
ℹ️ Note: Issue enrichment is currently in early access.
Disable automatic issue enrichment
To disable automatic issue enrichment, add the following to your .coderabbit.yaml:
issue_enrichment:
auto_enrich:
enabled: false
Please paste the exception details not as a single line but formatted into the issue, and fence it as a code block with backticks ` because this makes it needlessly hard to decipher the exception and help you.
This looks like a YesSql internal error. I don't understand though how WorkflowActionFilter.OnActionExecutionAsync() invokes this, since there's no ISession access (so something is missing from the stack trace, like WorkflowTypeStore).
- Which DB engine are you using?
- Is this with a local user account login or some SSO?
Disabled Coderabbit because nobody asked for this.
PostgreSql Not SSO, just auto setup , then try to login as admin at /Login?ReturnUrl=%2Freal-estate%2Fadmin
Thanks. No idea what may cause this, unfortunately.
is it possible because of cache, I used the similar recipe at #18398
Please use 3 ` like ```, we have to edit your issue almost every time to fix them otherwise. Thanks.
It looks like the session is trying to resolve an unknown type var itemType = Store.TypeNames[d.Type];. This could occur if the document (workflowTypeEntries) is not of the expected type. @gvkries 's analysis is that this could come from a wrongly shared cache whit colliding database ids (long).
Could you explain how your site is setup and how you use caching (Redis).
Looking at the linked issue, we need proof that the "shared" Redis instance is actually using two databases, or key prefixes, otherwise this can't work and that would explain the issue.
For instance, if you are starting two websites, isolated, with the Default tenant, but sharing the same redis instance, then Orchard has no way to isolate the keys, it might use "Default_" for both sites, and then there would be collisions. In that case you need to provide a different database number for each in the connection string, or a custom Redis prefix for each.
Which means you need to set the InstancePrefix option, with a different value for each site deployment (we already handle tenants for you) sharing the Redis instance :
//"OrchardCore_Redis": {
// "Configuration": "192.168.99.100:6379,allowAdmin=true", // Redis Configuration string.
// "InstancePrefix": "", // Optional prefix allowing a Redis instance to be shared by different applications.
// "DisableCertificateVerification": false // Disable SSL/TLS certificate verification.
// "AllowAdmin": false // Allow admin commands on the Redis server. May override the allowAdmin setting in the configuration string.
//},