浏览代码

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 年之前
父节点
当前提交
d97fc308cf
共有 1 个文件被更改,包括 3 次插入0 次删除
  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)