Open Closed

MySQL Connection Timeout Issue #8141


0
vincent.calaor created

Hi,

I am using MySQL as my database and running my web application on AWS Linux instance.

Every morning my site is down when I checked the logs it shows that the app cannot connect to MySQL (Command Time Out). I have to restart to make it run again.

Im not sure why is this occuring. I have hangfire running as well, I am not sure if its messing up with the MySQL after leaving it for a while. here are the error on my logs:

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
0|bars-app  |       An unhandled exception has occurred while executing the request.
0|bars-app  | MySql.Data.MySqlClient.MySqlException (0x80004005): Connect Timeout expired. ---> System.OperationCanceledException: The operation was canceled.
0|bars-app  |    at System.Threading.SemaphoreSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
0|bars-app  |    at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ConnectionPool.cs:line 46
0|bars-app  |    at MySql.Data.MySqlClient.MySqlConnection.CreateSessionAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 507
0|bars-app  |    at MySql.Data.MySqlClient.MySqlConnection.CreateSessionAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 523
0|bars-app  |    at MySql.Data.MySqlClient.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 232
0|bars-app  |    at MySql.Data.MySqlClient.MySqlConnection.Open() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 218
0|bars-app  |    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
0|bars-app  |    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
0|bars-app  |    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransaction(IsolationLevel isolationLevel)
0|bars-app  |    at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)        
0|bars-app  |    at Abp.EntityFrameworkCore.Uow.DbContextEfCoreTransactionStrategy.CreateDbContext[TDbContext](String connectionString, IDbContextResolver dbContextResolver) in D:\Github\aspnetboilerplate\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Uow\DbContextEfCoreTransactionStrategy.cs:line 38
0|bars-app  |    at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.GetOrCreateDbContext[TDbContext](Nullable`1 multiTenancySide, String name) in D:\Github\aspnetboilerplate\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Uow\EfCoreUnitOfWork.cs:line 120

5 Answer(s)
  • 0
    maliming created

    Can you check the status of mysql when site is down?

    eg

    show status like '%onn%';
    

    Will the site still go down when you disable hangfire? What is the mysql library of hangfire you use?

  • 0
    vincent.calaor created

    here are the dependencies to MySQL

    I will check tomorrow your Query on MySQL when it hangs again. after that I will try to turn off hangfire and see result.

    Thanks!

  • 0
    vincent.calaor created

    here is the query result after the Site hangs:

  • 0
    maliming created

    hi vincent.calaor

    If you disable hangfire, will the website still hang?

  • 0
    ismcagdas created

    This issue is closed because it has not had recent activity for a long time.