Open Closed

OpenId Server related exception after leaving the site unattended #8167


User avatar
0
alexander.nikonov created
  • ABP Framework version: v8.1.3
  • UI Type: Angular
  • Database System: EF Core (Oracle)
  • Auth Server Separated

I have already reported this bug before and you adviced me to replace some classes. I did this in the domain module (and closed the bug hoping it would help):

public static class IServiceCollectionExtension
{
    public static void ConfigureStores(this IServiceCollection services)
    {
        services.AddOpenIddict()
            .AddCore(builder =>
            {
                builder
                    .AddApplicationStore<AbxAbpOpenIddictApplicationStore>()
                    .AddAuthorizationStore<AbxAbpOpenIddictAuthorizationStore>()
                    .AddTokenStore<AbxAbpOpenIddictTokenStore>();
            });
    }
}

However I still get the same weird exception - but now with my class name:

[09:50:22 INF] Lock is acquired for TokenCleanupBackgroundWorker [09:50:22 ERR] An exception was thrown while activating Volo.Abp.OpenIddict.Tokens.TokenCleanupService -> ?:OpenIddict.Abstractions.IOpenIddictTokenManager -> Volo.Abp.OpenIddict.Tokens.AbpTokenManager -> Volo.Abp.OpenIddict.Tokens.AbpOpenIddictTokenCache -> AbxEps.OpenIddict.Stores.AbxAbpOpenIddictTokenStore. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.Abp.OpenIddict.Tokens.TokenCleanupService -> ?:OpenIddict.Abstractions.IOpenIddictTokenManager -> Volo.Abp.OpenIddict.Tokens.AbpTokenManager -> Volo.Abp.OpenIddict.Tokens.AbpOpenIddictTokenCache -> AbxEps.OpenIddict.Stores.AbxAbpOpenIddictTokenStore. ---> Autofac.Core.DependencyResolutionException: None of the constructors found on type 'AbxEps.OpenIddict.Stores.AbxAbpOpenIddictTokenStore' can be invoked with the available services and parameters: Cannot resolve parameter 'Volo.Abp.OpenIddict.Tokens.IOpenIddictTokenRepository repository' of constructor 'Void .ctor(Volo.Abp.OpenIddict.Tokens.IOpenIddictTokenRepository, Volo.Abp.Uow.IUnitOfWorkManager, Volo.Abp.Guids.IGuidGenerator, Volo.Abp.OpenIddict.Applications.IOpenIddictApplicationRepository, Volo.Abp.OpenIddict.Authorizations.IOpenIddictAuthorizationRepository, Volo.Abp.OpenIddict.AbpOpenIddictIdentifierConverter, Volo.Abp.OpenIddict.IOpenIddictDbConcurrencyExceptionHandler)'.

See https://autofac.rtfd.io/help/no-constructors-bindable for more info. at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass14_0.<UseSingleConstructorActivation>b__0(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Builder.RegistrationBuilder3.<>c__DisplayClass39_0.<OnActivated>b__0(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next) --- End of inner exception stack trace --- at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest& request) at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest& request) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Volo.Abp.OpenIddict.Tokens.TokenCleanupBackgroundWorker.DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) at Volo.Abp.OpenIddict.Tokens.TokenCleanupBackgroundWorker.DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) at Volo.Abp.BackgroundWorkers.AsyncPeriodicBackgroundWorkerBase.DoWorkAsync(CancellationToken cancellationToken) [09:50:22 ERR] ---------- Exception Data ---------- ActivatorChain = Volo.Abp.OpenIddict.Tokens.TokenCleanupService -> ?:OpenIddict.Abstractions.IOpenIddictTokenManager -> Volo.Abp.OpenIddict.Tokens.AbpTokenManager -> Volo.Abp.OpenIddict.Tokens.AbpOpenIddictTokenCache -> AbxEps.OpenIddict.Stores.AbxAbpOpenIddictTokenStore

I can see this exception after I leave my site unattented overnight (I hibernate my computer at night). Please try to reproduce this bug or at least analyze the exception and offer me the solution. Thank you.


8 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Cannot resolve parameter 'Volo.Abp.OpenIddict.Tokens.IOpenIddictTokenRepository repository'

    This generally indicates you haven't depended on the EF Core layer.

    Please share full Logs.txt file. Thanks.

    liming.ma@volosoft.com

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Your logs are not complete. Can you share a test project?

    I will download and test it.

    Thanks

  • User Avatar
    0
    alexander.nikonov created

    Unfortunately, we don't have a test project - our project is heavy and customized and it's not possible to create a test version of it. I cannot share an original project either.

    I have truncated the log file of the project since it was huge. So I will run a UI now and leave it till the exception get raised again - then I'll send you a complete log. Do you need a log of OpenID server as well? Just in case: there was no exception there.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Cannot resolve parameter 'Volo.Abp.OpenIddict.Tokens.IOpenIddictTokenRepository repository'

    This generally indicates you haven't depended on the EF Core layer.

    Please check if your website module depends on it.

    You can try to inject the TokenCleanupService to get the error instead of waiting for it to happen.

    https://github.com/abpframework/abp/blob/dev/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Tokens/TokenCleanupService.cs#L15

  • User Avatar
    0
    alexander.nikonov created

    You have a point here, thank you - some of the projects were missing AbpOpenIddictEntityFrameworkCoreModule dependency in their EntityFrameworkCoreModule. Nevertheless, I am planning to leave the site running overnight and will check the log in the morning.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    sure.

    Your project have to depends on EF Core if you want to run background jobs.

  • User Avatar
    0
    alexander.nikonov created

    The issue is resolved - the cleanup process is now successful. Thanks again.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    : )

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09