Skip to content

Commit

Permalink
Ensure that memdQRequests have nil pointers for queueNext
Browse files Browse the repository at this point in the history
If we requeue an operation it's possible that queueNext already
has a value set for it. As a result we should make sure to set
queueNext to nil since we always insert at the end of the linked
list. This resolves a deadlock issue where the last item in the
memdqueue was pointing to a previous item in the queue. If this
happens it can cause the drain function to loop infinitely and
deadlock the client on shutdown.

Change-Id: I943a56a49169cfa46f007e225553330c2db23ff7
Reviewed-on: http://review.couchbase.org/61677
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
  • Loading branch information
mikewied authored and brett19 committed Mar 17, 2016
1 parent d453f5a commit 3d0e906
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions gocbcore/memdopmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func (q *memdOpMap) Add(r *memdQRequest) {

q.opIndex++
r.Opaque = q.opIndex
r.queueNext = nil

if q.last == nil {
q.first = r
Expand Down

0 comments on commit 3d0e906

Please sign in to comment.