Only add DCBs to the list that arean't in the list

Listeners are added to the list multiple times due to how DCBs are removed
from the list.  This requires that an additional check is made so that we
are sure a DCB will not be added to the list twice.
This commit is contained in:
Markus Makela
2016-12-08 16:31:23 +02:00
parent 570e12942b
commit aa4ed2d28d

View File

@ -3415,6 +3415,15 @@ void dcb_append_readqueue(DCB *dcb, GWBUF *buffer)
void dcb_add_to_list(DCB *dcb)
{
if (dcb->dcb_role != DCB_ROLE_SERVICE_LISTENER ||
(dcb->thread.next == NULL && dcb->thread.tail == NULL))
{
/**
* This is a DCB which is either not a listener or it is a listener which
* is not in the list. Stopped listeners are not removed from the list
* as that part is done in the final zombie processing.
*/
spinlock_acquire(&all_dcbs_lock[dcb->thread.id]);
if (all_dcbs[dcb->thread.id] == NULL)
@ -3430,6 +3439,7 @@ void dcb_add_to_list(DCB *dcb)
spinlock_release(&all_dcbs_lock[dcb->thread.id]);
}
}
/**
* Remove a DCB from the owner's list