Base solution for your next web application
BLACK FRIDAY
From Nov 21
To Dec 1
XXDAYS : XXHRS : XXMIN : XXSEC
SAVE UP TO$3K
Also valid for the
existing customers!
Open Closed

Getting timeout exception in audit logs #10791


0
shedspotter created

What is your product version? 10.3.0

What is your product type (Angular or MVC)? Angular

What is product framework type (.net framework or .net core)? .NET 5

Hi , we are getting timeout exception while accessing the audit logs. please provide a solution as soon as possible.

Thanks


16 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Could you open your server side log file and share the error message related to this problem with us ?

    Thanks,

  • 0
    shedspotter created

    HI @ismcagdas Here is the exception detais:

    Routing Destination:fec47a56e385.HS2.tr1038.eastasia1-a.worker.database.windows.net,11008 ERROR 2022-01-05 11:43:57,137 [175 ] Mvc.ExceptionHandling.AbpExceptionFilter - Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (258): The wait operation timed out. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__169_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- 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.SingleQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at SmartSuite.Auditing.AuditLogAppService.GetAuditLogs(GetAuditLogsInput input) in D:\Taritas Projects\Anywhere\aspnet-core\src\SmartSuite.Application\Auditing\AuditLogAppService.cs:line 63 at lambda_method13534(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.

  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Normally, when you visit the audit logs page, it should retrieve the data only for the first page. Is it possible for you to share test credentials for your website with info@aspnetzero.com so we can test it ?

    Thanks,

  • 0
    shedspotter created

    Hi ismcagdas , sure we will send the credentials with you. I have debugg the audit logs api and I have found that the API is getting all the data of the tenant and than it will doing the query based on user id , i think this is the point where the time is taking. actully the api need to get the records from the db directly with the user id query .

    Thanks

  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Did you have a time to take a look at this ?

    I can offer you a few things;

    1. If you are not using ABP's latest version, you can upgrade to to latest version or at least latest 6.x.
    2. There might be some missing indexes on your AuditLogs table. If you are using SQL Server, you can check it using https://blog.sqlauthority.com/2011/01/03/sql-server-2008-missing-index-script-download/
  • 0
    shedspotter created

    Hi @ismcgdas, Here is the test credentials you requested:

    URL: http://taritas.anywhereapp.in/app/admin/auditLogs ID: supreet.tare@taritas.com PW: ]%>`xMyCK!Z['x3'

    Notice how you get an exception when you visit the Audit Log page, kindly take a look & let us know if we can do something without having to update the ADB version as an immediate fix.

    Looking forward to your response.

    Thanks

  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Is this happening on your local environment as well ?

  • 0
    shedspotter created

    Hi @ismcagdas yes it is happiing in local environment as well I have debugg the audit logs api and I have found that the API is getting all the data of the tenant and than it will doing the query based on user id , i think this is the point where the time is taking. actully the api need to get the records from the db directly with the user id query .

    Thanks

  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Is it possible to access your project and cehck this problem somehow ? If so, could you send an email to info@aspnetzero.com ?

  • 0
    shedspotter created

    Hi @ismcagdas Yes we can setup a call , and you can access it while in a call

  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    I think you will share your project via email with us for another problem. Could you write all the problens you are having in that email so we can check them all ?

  • 0
    sedulen created

    Hi @shedspotter - just following the conversation here - if you have access to your database server, how many records are in your AbpAuditLogs table?

    What RDBMS platform are you running? Microsoft SqlServer or another platform?

    -Brian

  • 0
    shedspotter created

    Hi @sedulen in prod we have 2885011 recoreds in dev we have 2923830 recoreds in audit logs

    What RDBMS platform are you running? Microsoft SqlServer or another platform? = > Microsoft SqlServer

  • 0
    shedspotter created

    Hi @ismcagdas https://support.aspnetzero.com/QA/Questions/10791/Getting-timeout-exception-in-audit-logs#answer-9b53a94b-ce46-34cf-ab05-3a01ea4692ae

    sorry we can not share source code with you due to proprietary , we are not allowed to share the code, is there any other way you can suggest it will be helpful , Thanks

  • 0
    sedulen created

    Hi @shedspotter

    since you are running .NET 5, are you able to implement logging to see what the generated SQL is: https://docs.microsoft.com/en-us/ef/core/logging-events-diagnostics/#microsoftextensionslogging

    that would at least give you the SQL you are running so that you could load it into Azure Data Studio or SqlServer Management Studio and see the generated query plan & execution.

    I haven't used .NET 5 yet, but I know .NET 2.2 produced some terrible SQL queries, especially when using Global Filters.

    A trick I've used for applications we'd developed in .NET 2.2 was to disable the global filters set by the ANZ framework, and to explicitly add them myself

    A crud example is: return _thingRepository.GetAll() .Where(e => e.IsSomething == true) .ToList(); re-writing that to be: return _thingRepository.GetAll() .IgnoreQueryFilters() .Where(e => e.TenantId == AbpSession.TenantId && !e.IsDeleted) .Where(e => e.IsSomething == true) .ToList();

    adding the .IgnoreQueryFilters() disables the built-in global filters for Tenancy and Deletion, if your Entity has tenancy or soft delete . if you do this, you have to remember to add .Where(e => e.TenantId == AbpSession.TenantId && !e.IsDeleted), otherwise you violate your tenancy boundary.

    I don't do this often, but I have done it occassionally.

    In .NET 2.2, there was an easy extension available to get the generated SQL output. I know that changed in .NET 3.1, and has changed again in .NET 5+

    The main reason I suggest looking at your query is to see the execution plan. For a table like the AbpAuditLog, where you are going to have LOTS of records, the clustered index matters. By default, a SQL table's clustered index is the PK, which in this case is fairly useless.

    Depending upon how you are querying the table in your SQL, you may need to consider adding missing indexes, or even changing the clustered index.

    ^ I'm not sure your experience with SqlServer and tables and indexes, so apologies if I'm reviewing topics you already know and have already explored.

    Let me know if that helps, -Brian

  • 0
    ismcagdas created
    Support Team

    @sedulen, thank you for your help.

    @shedspotter, let me know if you are still having this problem and we can arrange a remote meeting.