Pending tasks list flooded with _add_listener_ tasks

I have an elasticsearch cluster running with a handful of nodes and it periodically (as in every few minutes) falls down with a master_not_discovered_exception. While investigating I notice that when I check _cat/pending_tasks there are hundreds of pending tasks with source == "add_listener".

Example:
672140 387ms HIGH _add_listener_

I'm trying to find out what kind of requests result in an add_listener task so that I can track down the source of the requests. Any help would be greatly appreciated.

I don't know that code very well but I do know that you'll need to tell us what version of Elasticsearch you are using for anyone to be able to help.

We are running 2.2.0, on Windows Server 2012 R2. There are 11 nodes in the cluster. They are all master and data nodes. Right now I'm not actively indexing any documents but there are about 120,000 documents already indexed.

It seems like long queue times are causing the ping requests to timeout, but I'm not sure why the pending tasks queue is long when I'm not indexing or querying anything.

Hi Robert, have solved this problem on Mac.

For version 2.2.1 I have similar entries with kibana connection errors to elasticsearch frequently.