• Daniel Theophanes's avatar
    database/sql: prevent race in driver by locking dc in Next · 897080d5
    Daniel Theophanes authored
    Database drivers should be called from a single goroutine to ease
    driver's design. If a driver chooses to handle context
    cancels internally it may do so.
    
    The sql package violated this agreement when calling Next or
    NextResultSet. It was possible for a concurrent rollback
    triggered from a context cancel to call a Tx.Rollback (which
    takes a driver connection lock) while a Rows.Next is in progress
    (which does not tack the driver connection lock).
    
    The current internal design of the sql package is each call takes
    roughly two locks: a closemu lock which prevents an disposing of
    internal resources (assigning nil or removing from lists)
    and a driver connection lock that prevents calling driver code from
    multiple goroutines.
    
    Fixes #21117
    
    Change-Id: Ie340dc752a503089c27f57ffd43e191534829360
    Reviewed-on: https://go-review.googlesource.com/65731Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    897080d5
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...