MySqlConnector.MySqlException: Lock wait timeout exceeded; try restarting transaction

Tags: #<Tag:0x00007fafee376928>

Hello Team,
In our application, we use around 4000 recurring jobs, which execute every 30 minutes and we are getting below “lock wait time out exception”. the version of hangfire we use is 2.0.3. whenever hangfire hits a particular table it locks it to complete the transaction in the meanwhile other threads wait for that transaction to complete and we think that we need to allow more time to the thread as we have more recurring jobs. can we make any changes in the application level on hangfire settings to resolve the below exception?

MySqlConnector.MySqlException: Lock wait timeout exceeded; try restarting transaction
MySqlConnector.MySqlException (0x80004005): Lock wait timeout exceeded; try restarting transaction
at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in //src/MySqlConnector/Core/ResultSet.cs:line 52
at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /
/src/MySqlConnector/MySqlDataReader.cs:line 137
at MySqlConnector.MySqlDataReader.CreateAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary2 cachedProcedures, IMySqlCommand command, CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 445 at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/Core/CommandExecutor.cs:line 60
at MySqlConnector.MySqlCommand.ExecuteNonQueryAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /
/src/MySqlConnector/MySqlCommand.cs:line 266
at MySqlConnector.MySqlCommand.ExecuteNonQuery() in /_/src/MySqlConnector/MySqlCommand.cs:line 101
at Datadog.Trace.ClrProfiler.Integrations.AdoNet.IDbCommandIntegration.ExecuteNonQuery(Object command, Int32 opCode, Int32 mdToken, Int64 moduleVersionPtr) in /home/vsts/work/1/s/src/Datadog.Trace.ClrProfiler.Managed/Integrations/AdoNet/IDbCommandIntegration.cs:line 253

Please let me know if you need any more details on this issue.

Thanks.