• Daniel Theophanes's avatar
    database/sql: prevent Tx.rollback from racing Tx.close · 9def8570
    Daniel Theophanes authored
    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/34716Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    9def8570
sql.go 65.9 KB