Skip to content

Expected state to be Connected but was Failed. #674

@jon-swain-autocab

Description

@jon-swain-autocab

Hi,

Version: 0.49.3 (Also confirmed as issue on 0.56.0)

We are getting the following exception whenever we lose connection to the MySql server.

This can easily be re-created with a simple console application which runs the simple query 'SELECT 1' every second (with a try catch around it). Whilst the application is running stop and then restart the MySql server and the exception will be logged.

It seems the issue is that the State property is set to 'Open' but internally you have a stats set to 'Failed'

System.InvalidOperationException: Expected state to be Connected but was Failed.
at MySqlConnector.Core.ServerSession.VerifyState(State state)
at MySqlConnector.Core.ServerSession.StartQuerying(MySqlCommand command)
at MySqlConnector.Core.TextCommandExecutor.d__1.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MySql.Data.MySqlClient.MySqlCommand.d__63.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar()
at GhostAccounts.Server.Database.MaxJobIdImportedIntoDatabase.GetValue(ConnectionWrapper aConnection) in C:\Autocab\Ghost-git1\GhostAccounts.Server\Database\MaxJobIdImportedIntoDatabase.cs:line 31
at Gpc.Server.Accounts.AccountsServer.ProcessNextBatchOfJobMessagesFromDispatcher() in C:\Autocab\Ghost-git1\Server.Accounts\AccountsServer.cs:line 145
at Gpc.Server.Accounts.AccountsServer.ProcessNextBatchOfJobMessagesFromDispatcherIfItsTimeToDoSo() in C:\Autocab\Ghost-git1\Server.Accounts\AccountsServer.cs:line 127 --> Critical exception caught in Gpc.Server.Accounts.AccountsServer.ProcessNextBatchOfJobMessagesFromDispatcherIfItsTimeToDoSo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions