Pomelo.EntityFrameworkCore.MySql icon indicating copy to clipboard operation
Pomelo.EntityFrameworkCore.MySql copied to clipboard

An exception has been raised that is likely due to a transient failure

Open kenkenken123 opened this issue 2 years ago • 3 comments

The issue

This error occurs in the interval of some requests. What can I do to solve it?

Exception message:An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseMySql' call.
   at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int32 startTickCount, Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 944
   at MySqlConnector.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 451
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
   at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlRelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
   at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)

Further technical details

MySQL version: 5.7 Operating system: docker---mcr.microsoft.com/dotnet/aspnet:6.0 Pomelo.EntityFrameworkCore.MySql version: 6.0.2 Microsoft.AspNetCore.App version: 6

kenkenken123 avatar Dec 30 '22 07:12 kenkenken123

You haven't provided enough context. Are you doing a migration, or querying or updating the db? Is there an inner exception?

mguinness avatar Dec 31 '22 01:12 mguinness

inner exception is “Connect Timeout expired.” i use contextpool ,i guess the pool is full??

kenkenken123 avatar Dec 31 '22 10:12 kenkenken123

I suspect that you have a networking issue between your docker instance and the MySQL server.

I would suggest asking a question on Stack Overflow with your configuration for further help.

Cannot connect Asp.net Core WebApi in Docker with EFCore Mysql provider to non Docker Mysql on host server

mguinness avatar Dec 31 '22 18:12 mguinness