mysql: Intermittent error - sql: driver does not support non-default isolation level

Issue description

We’re pushing on average ~5k QPS and we see intermittent spurts of errors when we try to begin a transaction. We’ve seen this error happen a few hundred thousand times over the last 24 hours. It will appear and then resolve itself typically within an hour if we don’t catch it first. It is happening across multiple handlers, and we still have millions of transactions starting within that same hour. We are also able to successfully use other isolation levels most of the time.

It feels like there is either a race condition somewhere or there is another transient error happening that is triggering the wrong error value. I can’t reliably reproduce it, but it has been happening for a few weeks on multiple versions of the driver.

The issue began when we started explicitly passing in sql.TxOptions. We mitigated the problem by sending in nil when we’re using REPEATABLE READ, since that is the driver default and accounts for > 99% of our transaction volume.

I’m not super familiar with the stdlib <-> driver interaction, but I’m happy to help debug where I can help. Thanks for a great driver!

Example code

tx, err := db.BeginTx(c, &sql.TxOptions{
	Isolation: sql.LevelRepeatableRead,
})

Error log

sql: driver does not support non-default isolation level

Configuration

Driver version (or git SHA): 9181e3a86a19bacd63e68d43ae8b7b36320d8092 fade21009797158e7b79e04c340118a9220c6f9e

Go version: run go version in your console 1.9.2

Server version: E.g. MySQL 5.6, MariaDB 10.0.20 5.7.20

Server OS: E.g. Debian 8.1 (Jessie), Windows 10 Debian 8.9

cc @kardianos @josephbergevin

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 17 (3 by maintainers)

Most upvoted comments

As far as I can tell, switching to the master branch has fixed this for me. So I’d also say it’s time for a new release 😃

 [[constraint]]
   name = "github.com/go-sql-driver/mysql"
-  version = "1.3.0"
+  branch = "master"

I have the same experience as @wayneashleyberry. We first started to notice the error after moving to go 1.10. Changing the dependency to master works, but we would like to be back on a stable version as soon as possible.

Thanks!

There’s a tracking PR for the next release if anyone’s interested.

https://github.com/go-sql-driver/mysql/pull/809