• Daniel Theophanes's avatar
    database/sql: do not bypass the driver locks with Context methods · 0d163ce1
    Daniel Theophanes authored
    When context methods were initially added it was attempted to unify
    behavior between drivers without Context methods and those with
    Context methods to always return right away when the Context expired.
    However in doing so the driver call could be executed outside of the
    scope of the driver connection lock and thus bypassing thread safety.
    
    The new behavior waits until the driver operation is complete. It then
    checks to see if the context has expired and if so returns that error.
    
    Change-Id: I4a5c7c3263420c57778f36a5ed6fa0ef8cb32b20
    Reviewed-on: https://go-review.googlesource.com/32422Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    0d163ce1
ctxutil.go 3.8 KB