Skip to main content

273 posts tagged with "Fixes"

Fixes for Common Issues and Errors

View All Tags

Fixed: "NullReferenceException" at NativeDriver.ExecutePacketAsync During a MySQL Restart in EF Core

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

MySQL restarted while orders were coming in. The retries did their job for most requests, and then 8 of 96 failed with System.NullReferenceException from deep inside MySql.Data. None of my code was in the failing frames. A retry was using a connection that the driver had left marked as open.

Fixed: "RetryLimitExceededException: The maximum number of retries (3) was exceeded" in EF Core with MySQL

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

A request took about 4 seconds, and then failed with RetryLimitExceededException: The maximum number of retries (3) was exceeded while executing database operations. That exception means EF Core did its job and ran out of attempts. The cause is one level down, and the client deserves a better answer than a 500.

Fixed: "error CS8031: Async lambda expression converted to a 'Task' returning delegate cannot return a value"

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

Wrapping an endpoint's work in strategy.ExecuteAsync gave error CS8031: Async lambda expression converted to a 'Task' returning delegate cannot return a value. The code looks right, and it returns values on purpose. The compiler just can't work out one type for those values, and a small addition tells it.

Fixed: "The configured execution strategy 'MySQLRetryingExecutionStrategy' does not support user-initiated transactions" in EF Core

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

As soon as I wrapped two writes in BeginTransactionAsync, the endpoint failed with The configured execution strategy 'MySQLRetryingExecutionStrategy' does not support user-initiated transactions. The message tells you the method to use, and here's the shape of the code it means.

Fixed: "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool" with MySql.Data

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

A request that normally takes a millisecond failed after exactly 15 seconds with error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. MySQL itself was fine and nearly idle. All the app's connections were taken, by requests that were never going to finish.

Fixed: A Request Never Answers When a MySQL Statement Runs Longer Than CommandTimeout (MySql.Data)

· 8 min read
Jagdish Kumawat
Founder @ Dewiride

I set a short CommandTimeout, expecting an error when a statement ran too long. Instead, the request never answered at all. MySQL had finished long ago, and the connection sat idle, out of reach of everything else. If you're on Oracle's MySql.Data, any async statement slower than CommandTimeout can do this, including a default of 30 seconds behind a row lock.

Fixed: EF Core EnableRetryOnFailure Doesn't Retry MySQL Errors with Oracle's MySql.EntityFrameworkCore

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

I had EnableRetryOnFailure turned on, so I assumed a deadlock or a short outage would be retried. With Oracle's MySQL provider, nothing was retried, ever, and no message says so. The provider asks each error whether it's temporary, and MySqlException always answers no. The fix is one argument.