1. 26 Jan, 2017 2 commits
    • Daniel Theophanes's avatar
      database/sql: fix race when canceling queries immediately · 2b283ced
      Daniel Theophanes authored
      Previously the following could happen, though in practice it would
      be rare.
      
      Goroutine 1:
      	(*Tx).QueryContext begins a query, passing in userContext
      
      Goroutine 2:
      	(*Tx).awaitDone starts to wait on the context derived from the passed in context
      
      Goroutine 1:
      	(*Tx).grabConn returns a valid (*driverConn)
      	The (*driverConn) passes to (*DB).queryConn
      
      Goroutine 3:
      	userContext is canceled
      
      Goroutine 2:
      	(*Tx).awaitDone unblocks and calls (*Tx).rollback
      	(*driverConn).finalClose obtains dc.Mutex
      	(*driverConn).finalClose sets dc.ci = nil
      
      Goroutine 1:
      	(*DB).queryConn obtains dc.Mutex in withLock
      	ctxDriverPrepare accepts dc.ci which is now nil
      	ctxCriverPrepare panics on the nil ci
      
      The fix for this is to guard the Tx methods with a RWLock
      holding it exclusivly when closing the Tx and holding a read lock
      when executing a query.
      
      Fixes #18719
      
      Change-Id: I37aa02c37083c9793dabd28f7f934a1c5cbc05ea
      Reviewed-on: https://go-review.googlesource.com/35550
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      2b283ced
    • Robert Griesemer's avatar
      go/printer: fix format with leading comments in composite literal · 1cf08182
      Robert Griesemer authored
      This fix is less pervasive than it seems. The only change affecting
      formatting is on printer.go:760. The remaining changes have no effect
      on formatting since the value of p.level is ignored except on this
      specific line.
      
      The remaining changes are:
      - renamed adjBlock to funcBody since that's how it is used
      - introduced new printer field 'level' tracking the composite
        literal nesting level
      - update/restore the composite literal nesting level as needed
      
      Fixes #18782.
      
      Change-Id: Ie833a9b5a559c4ec0f2eef2c5dc97aa263dca53a
      Reviewed-on: https://go-review.googlesource.com/35811Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      1cf08182
  2. 25 Jan, 2017 2 commits
  3. 24 Jan, 2017 7 commits
  4. 23 Jan, 2017 1 commit
    • Keith Randall's avatar
      runtime: amd64, use 4-byte ops for memmove of 4 bytes · a96e117a
      Keith Randall authored
      memmove used to use 2 2-byte load/store pairs to move 4 bytes.
      When the result is loaded with a single 4-byte load, it caused
      a store to load fowarding stall.  To avoid the stall,
      special case memmove to use 4 byte ops for the 4 byte copy case.
      
      We already have a special case for 8-byte copies.
      386 already specializes 4-byte copies.
      I'll do 2-byte copies also, but not for 1.8.
      
      benchmark                 old ns/op     new ns/op     delta
      BenchmarkIssue18740-8     7567          4799          -36.58%
      
      3-byte copies get a bit slower.  Other copies are unchanged.
      name         old time/op   new time/op   delta
      Memmove/3-8   4.76ns ± 5%   5.26ns ± 3%  +10.50%  (p=0.000 n=10+10)
      
      Fixes #18740
      
      Change-Id: Iec82cbac0ecfee80fa3c8fc83828f9a1819c3c74
      Reviewed-on: https://go-review.googlesource.com/35567
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      a96e117a
  5. 21 Jan, 2017 1 commit
  6. 20 Jan, 2017 4 commits
  7. 19 Jan, 2017 2 commits
  8. 18 Jan, 2017 4 commits
  9. 17 Jan, 2017 4 commits
  10. 16 Jan, 2017 4 commits
  11. 14 Jan, 2017 4 commits
  12. 13 Jan, 2017 5 commits