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

Error from TokenCleanupService.CleanAsync #19460

Closed
hexianggui opened this issue Apr 1, 2024 · 2 comments
Closed

Error from TokenCleanupService.CleanAsync #19460

hexianggui opened this issue Apr 1, 2024 · 2 comments
Assignees

Comments

@hexianggui
Copy link

ABP Framework version:7.3.2.

  • database provider:EF Core

Stack Overflow

Stack :

DELETE FROM [o]
FROM [OpenIddictTokens] AS [o]
WHERE (@__ef_filter__p_0 = CAST(1 AS bit) OR [o].[IsDeleted] = CAST(0 AS bit)) AND ([o].[AuthorizationId] IS NOT NULL) AND [o].[AuthorizationId] IN ('e649738a-d696-6056-43e9-3a0d758c1382',
....(Multiple IDs hidden here, totaling approximately 1.6MB in length)...
'252de6d3-d1b3-4545-d665-3a0d76015515')

2024-03-31 00:00:16.771 +08:00 [ERR] The query processor ran out of internal resources and could not produce a query plan.  This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions.  Please simplify the query.  If you believe you've received this message in error, contact Customer Support Services for more information.
Microsoft.Data.SqlClient.SqlException (0x80131904): The query processor ran out of internal resources and could not produce a query plan.  This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions.  Please simplify the query.  If you believe you've received this message in error, contact Customer Support Services for more information.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at Microsoft.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader(Boolean isInternal, Boolean forDescribeParameterEncryption)
   at Microsoft.Data.SqlClient.SqlCommand.InternalEndExecuteNonQuery(IAsyncResult asyncResult, Boolean isInternal, String endMethod)
   at Microsoft.Data.SqlClient.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult)
   at Microsoft.Data.SqlClient.SqlCommand.EndExecuteNonQueryAsync(IAsyncResult asyncResult)
   at Microsoft.Data.SqlClient.SqlCommand.<>c.<InternalExecuteNonQueryAsync>b__208_1(IAsyncResult result)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location ---
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Volo.Abp.OpenIddict.Authorizations.EfCoreOpenIddictAuthorizationRepository.PruneAsync(DateTime date, CancellationToken cancellationToken)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Volo.Abp.OpenIddict.Authorizations.AbpOpenIddictAuthorizationStore.PruneAsync(DateTimeOffset threshold, CancellationToken cancellationToken)
   at Volo.Abp.OpenIddict.Tokens.TokenCleanupService.CleanAsync()

Should TokenCleanupService.CleanAsync() be implemented by the module itself instead of using TokenManager.PruneAsync(threshold)?

@maliming maliming self-assigned this Apr 1, 2024
@maliming
Copy link
Member

maliming commented Apr 1, 2024

hi

The EF Core has been fixed in 8.0.

You can refer to dotnet/efcore#13617 and https://stackoverflow.com/questions/24534217/scalable-contains-method-for-linq-against-a-sql-backend

By the way, you can use the latest PruneAsync code in your 7.3.x project. We've made some enhancement changes.

@hexianggui
Copy link
Author

@maliming Thank you!
Upgrading to 8.0 is a bit difficult for now. I've tried upgrading to 8.0 before, but encountered many problems along the way. Although the upgrade was successful in the development environment, I cannot upgrade in the production environment at the moment.

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

No branches or pull requests

2 participants