Whenever a listener is being removed from the leader, a notification is sent to leader's change channel. This is done while holding a lock. If the channel is full, the function will block here.
On the other side, if leaderServer is processing a notification on leader's change channel, It will call GetActiveEnsembleSize which also attempts to take same lock (which is held by removeListener), and hence leading to a deadlock.
|For Gerrit Dashboard: MB-40407|
|140991,3||MB-40407: Avoid deadlock in leader if changech is full||alice||gometa||Status: MERGED||+2||+1|
|140992,3||MB-40407: Increase size of the change notification channel in leader||alice||gometa||Status: MERGED||+2||+1|