Selaa lähdekoodia

Merge pull request #179 from ChannelMeter/fix-batch-deadlock-nil-access

executeBatch can cause a dead lock to a nil deref causing c.prepMu not to be unlocked.
Phillip Couto 11 vuotta sitten
vanhempi
commit
d97fc308cf
1 muutettua tiedostoa jossa 3 lisäystä ja 0 poistoa
  1. 3 0
      conn.go

+ 3 - 0
conn.go

@@ -505,6 +505,9 @@ func (c *Conn) executeBatch(batch *Batch) error {
 		c.prepMu.Lock()
 		found := false
 		for stmt, flight := range c.prep {
+			if flight == nil || flight.info == nil {
+				continue
+			}
 			if bytes.Equal(flight.info.id, x.StatementId) {
 				found = true
 				delete(c.prep, stmt)