Skip to content

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

Closed as not planned
@derekperkins

Description

@derekperkins

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):
9181e3a
fade210

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions