Skip to content

Commit 741471d

Browse files
committed
fix: fix a deadlock issue when it occurs simultaneously: a goroutine is trying to lock, and another goroutine waits since full of channel buffers #440
1 parent 7778a1c commit 741471d

File tree

4 files changed

+0
-12
lines changed

4 files changed

+0
-12
lines changed

conn.go

-2
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,6 @@ func (l *Conn) nextMessageID() int64 {
327327
// GetLastError returns the last recorded error from goroutines like processMessages and reader.
328328
// Only the last recorded error will be returned.
329329
func (l *Conn) GetLastError() error {
330-
l.messageMutex.Lock()
331-
defer l.messageMutex.Unlock()
332330
return l.err
333331
}
334332

response.go

-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ func (r *searchResponse) Next() bool {
6060
if r.err != nil {
6161
return false
6262
}
63-
r.err = r.conn.GetLastError()
64-
if r.err != nil {
65-
return false
66-
}
6763
r.entry = res.Entry
6864
r.referral = res.Referral
6965
r.controls = res.Controls

v3/conn.go

-2
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,6 @@ func (l *Conn) nextMessageID() int64 {
327327
// GetLastError returns the last recorded error from goroutines like processMessages and reader.
328328
// // Only the last recorded error will be returned.
329329
func (l *Conn) GetLastError() error {
330-
l.messageMutex.Lock()
331-
defer l.messageMutex.Unlock()
332330
return l.err
333331
}
334332

v3/response.go

-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ func (r *searchResponse) Next() bool {
6060
if r.err != nil {
6161
return false
6262
}
63-
r.err = r.conn.GetLastError()
64-
if r.err != nil {
65-
return false
66-
}
6763
r.entry = res.Entry
6864
r.referral = res.Referral
6965
r.controls = res.Controls

0 commit comments

Comments
 (0)