Base solution for your next web application
Open Closed

Error when taking Jwt token in Host Layer #11240


User avatar
0
tdv.yazilim created

Hello,

Version is; 11,1 . Asp.net core mvc jquery.

We are using the host layer for our mobile application After a while, we get an error while taking tokens.

Our token taking period starts to increase after a while or we cannot perform any token takes. We are waiting for your help about this error. We have 2 different errors in the application logs related to this. These errors are listed below.

Error 1

System.ArgumentNullException: Value cannot be null. (Parameter 'Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.') at Name.Web.Controllers.TokenAuthController.Authenticate(AuthenticateModel model) in C:\Users\A\source\repos\Name.ProjectName\src\ProjectName.Web.Core\Controllers\TokenAuthController.cs:line 239 at lambda_method1534(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__Logged|12_1(ControllerActionInvoker invoker) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

Value cannot be null. (Parameter 'Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.')

Error 2

System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry, SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open() at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.OpenDbConnection(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransaction(IsolationLevel isolationLevel) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.<>c__DisplayClass22_0.<BeginTransaction>b__0(DatabaseFacade database) at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass12_02.<Execute>b__0(DbContext c, TState s) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func`3 veri...

Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @tdv.yazilim

    Could you answer the questions below, so we can help you.

    1. Do you use Redis on your app ?
    2. Could you check if you have the changes in below PRs on your project ?
  • User Avatar
    0
    tdv.yazilim created

    Hi, We do not use Redis in token transactions in our application. We also reviewed the codes on github you mentioned above. We did not detect any changes in our project.

    We did our experiments on the new empty Zero project. We faced the same problem in the new project.

    We did our tests with jmeter with the settings you specified at https://blog.aspnetzero.com/blogs/asp.net-zero/running-load-test-on-asp.net-zero. We are getting this error even in 50 users in our environments.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @tdv.yazilim

    We tried with unmodified latest version and didn't get the error you are getting. Is it possible to share your JMeter test file and sample excel data file ? If we can't reproduce this error with your sample data, we can arrange a meeting and take a look at your project in an online meeting.

  • User Avatar
    0
    tdv.yazilim created

    Hi, We have sent the files you requested to the [email protected] e-mail address. We can also show you the problem we encounter as an online meeting.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @tdv.yazilim

    Thanks, we got the email. We will inform you once we test the files you send and we can arrange a meeting.