소스 검색

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)