]> Cypherpunks repositories - gostls13.git/commit
database/sql: prevent Tx.rollback from racing Tx.close
authorDaniel Theophanes <kardianos@gmail.com>
Mon, 26 Dec 2016 19:33:46 +0000 (11:33 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 2 Jan 2017 20:21:02 +0000 (20:21 +0000)
commit9def857072bb708a79c291bb88c4b2830f0a8376
treeb617795befd3aa442ec0bb8b20e0c165ad67343e
parentf78cd569f52d5c44792f932ebbd01a71231f38b2
database/sql: prevent Tx.rollback from racing Tx.close

Previously Tx.done was being set in close, but in a Tx
rollback and Commit are the real closing methods,
and Tx.close is just a helper common to both. Prior to this
change a multiple rollback statements could be called, one
would enter close and begin closing it while the other was
still in rollback breaking it. Fix that by setting done
in rollback and Commit, not in Tx.close.

Fixes #18429

Change-Id: Ie274f60c2aa6a4a5aa38e55109c05ea9d4fe0223
Reviewed-on: https://go-review.googlesource.com/34716
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/database/sql/sql.go
src/database/sql/sql_test.go