Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] This MySqlConnection is already in use #134

Closed
csportalsk opened this issue Feb 2, 2024 · 2 comments
Closed

[BUG] This MySqlConnection is already in use #134

csportalsk opened this issue Feb 2, 2024 · 2 comments
Assignees
Labels
Bug For problems or errors in the project that need fixing. Priority: High Issues that affect the project's progress significantly and need to be addressed as soon as possible Solved The issue has been solved

Comments

@csportalsk
Copy link

CSSv154, K4v3.3.0, Metamod:Source version 2.0.0-dev+1280, game_type 0, game_mode 1, Linux
After update -> v3.3.0 errors on log

[EROR] (cssharp:Core) Error invoking callback
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.AggregateException: One or more errors occurred. (This MySqlConnection is already in use. See https://fl.vu/mysql-conn-reuse)
 ---> System.InvalidOperationException: This MySqlConnection is already in use. See https://fl.vu/mysql-conn-reuse
   at MySqlConnector.Core.ServerSession.StartQuerying(ICancellableCommand command) in /_/src/MySqlConnector/Core/ServerSession.cs:line 289
   at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 50
   at MySqlConnector.MySqlCommand.ExecuteReaderAsync(CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 357
   at K4System.Database.ExecuteReaderAsync(String query, MySqlParameter[] parameters)
   at K4System.ModuleRank.<>c__DisplayClass7_0.<<OnCommandTop>b__0>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at K4System.ModuleRank.OnCommandTop(CCSPlayerController player, CommandInfo info)
   at CounterStrikeSharp.API.Core.BasePlugin.<>c__DisplayClass41_0.<AddCommand>b__0(Int32 i, IntPtr ptr) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/BasePlugin.cs:line 260
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.FunctionReference.<>c__DisplayClass3_0.<.ctor>b__0(fxScriptContext* context) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 82
@csportalsk csportalsk added Bug For problems or errors in the project that need fixing. Priority: Medium Important issues that should be resolved after higher priorities. labels Feb 2, 2024
@K4ryuu
Copy link
Owner

K4ryuu commented Feb 6, 2024

Note for myself about the error:

The problem caused by any MySQL query that is being .Wait()-ed. Those causes deadlocks in the connection reuse, so all of them should be changed to use custom async functions with callback invoke to continue code on main thread (prevent non-main thread problems also)

@K4ryuu K4ryuu added Priority: High Issues that affect the project's progress significantly and need to be addressed as soon as possible In Progress Issues currently being worked on. Solved The issue has been solved and removed Priority: Medium Important issues that should be resolved after higher priorities. In Progress Issues currently being worked on. labels Feb 6, 2024
@K4ryuu
Copy link
Owner

K4ryuu commented Feb 6, 2024

Greetings,
The problem has been fixed hopefully, but if you encounter the problem again, please re-open this issue.
Appreciate it!

@K4ryuu K4ryuu closed this as completed Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For problems or errors in the project that need fixing. Priority: High Issues that affect the project's progress significantly and need to be addressed as soon as possible Solved The issue has been solved
Projects
None yet
Development

No branches or pull requests

2 participants