# Concurrent Modification Exception being received

**URL:** <https://discuss.elastic.co/t/concurrent-modification-exception-being-received/4378>\
**Category:** Elasticsearch\
**Created:** [May 10, 2011, 10:53pm UTC](https://discuss.elastic.co/t/concurrent-modification-exception-being-received/4378 "2011-05-10T22:53:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pat\_Christopher](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Pat\_Christopher](https://discuss.elastic.co/u/Pat_Christopher)\
**Post date:** [May 10, 2011, 10:53pm UTC](https://discuss.elastic.co/t/concurrent-modification-exception-being-received/4378/1 "2011-05-10T22:53:44Z")

</div>

Hi,  
I'm running ES 0.16.0 and I'm getting the following exception when  
creating a TransportClient:

Exception in thread "main" java.util.ConcurrentModificationException  
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)  
at java.util.HashMap$KeyIterator.next(Unknown Source)  
at org.elasticsearch.client.transport.TransportClientNodesService  
$ScheduledSniffNodesSampler.run(TransportClientNodesService.java:258)  
at  
org.elasticsearch.client.transport.TransportClientNodesService.addTransportAddress(TransportClientNodesService.java:  
117)  
at  
org.elasticsearch.client.transport.TransportClient.addTransportAddress(TransportClient.java:  
197)  
at  
com.mycom.pac.elasticsearch.example.ElasticSearchExample.main(ElasticSearchExample.java:  
30)

I'm creating a TransportClient node as follows:

TransportClient client = new  
TransportClient(settingsBuilder().put("cluster.name","myCluster")  
.put("client.transport.sniff",true))  
.addTransportAddress(new  
InetSocketTransportAddress("ec2-ip-address", 9300));

If I remove the client.transport.sniff settings put, the client  
connects correctly.

Am I doing this wrong or is it a bug of some sort?

Thanks,  
Pat

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 10, 2011, 11:01pm UTC](https://discuss.elastic.co/t/concurrent-modification-exception-being-received/4378/2 "2011-05-10T23:01:16Z")

</div>

Fixed: [Possible failure when using TransportClient (with sniffing) · Issue #923 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/923). Will be part of 0.16.1 which will be released in a couple of days.  
On Wednesday, May 11, 2011 at 1:53 AM, Pat Christopher wrote:

> Hi,  
> I'm running ES 0.16.0 and I'm getting the following exception when  
> creating a TransportClient:
> 
> Exception in thread "main" java.util.ConcurrentModificationException  
> at java.util.HashMap$HashIterator.nextEntry(Unknown Source)  
> at java.util.HashMap$KeyIterator.next(Unknown Source)  
> at org.elasticsearch.client.transport.TransportClientNodesService  
> $ScheduledSniffNodesSampler.run(TransportClientNodesService.java:258)  
> at  
> org.elasticsearch.client.transport.TransportClientNodesService.addTransportAddress(TransportClientNodesService.java:  
> 117)  
> at  
> org.elasticsearch.client.transport.TransportClient.addTransportAddress(TransportClient.java:  
> 197)  
> at  
> com.mycom.pac.elasticsearch.example.ElasticSearchExample.main(ElasticSearchExample.java:  
> 30)
> 
> I'm creating a TransportClient node as follows:
> 
> TransportClient client = new  
> TransportClient(settingsBuilder().put("cluster.name","myCluster")  
> .put("client.transport.sniff",true))  
> .addTransportAddress(new  
> InetSocketTransportAddress("ec2-ip-address", 9300));
> 
> If I remove the client.transport.sniff settings put, the client  
> connects correctly.
> 
> Am I doing this wrong or is it a bug of some sort?
> 
> Thanks,  
> Pat

---

<div class="post-metadata">

**Author:** ![Pat\_Christopher](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Pat\_Christopher](https://discuss.elastic.co/u/Pat_Christopher)\
**Post date:** [May 10, 2011, 11:09pm UTC](https://discuss.elastic.co/t/concurrent-modification-exception-being-received/4378/3 "2011-05-10T23:09:09Z")

</div>

yay!

Thanks Shay.

On May 10, 4:01 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Fixed:[Possible failure when using TransportClient (with sniffing) · Issue #923 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/923). Will be part of 0.16.1 which will be released in a couple of days.
> 
> On Wednesday, May 11, 2011 at 1:53 AM, Pat Christopher wrote:
> 
> > Hi,  
> > I'm running ES 0.16.0 and I'm getting the following exception when  
> > creating a TransportClient:
> 
> > Exception in thread "main" java.util.ConcurrentModificationException  
> > at java.util.HashMap$HashIterator.nextEntry(Unknown Source)  
> > at java.util.HashMap$KeyIterator.next(Unknown Source)  
> > at org.elasticsearch.client.transport.TransportClientNodesService  
> > $ScheduledSniffNodesSampler.run(TransportClientNodesService.java:258)  
> > at  
> > org.elasticsearch.client.transport.TransportClientNodesService.addTransportAddress(TransportClientNodesService.java:  
> > 117)  
> > at  
> > org.elasticsearch.client.transport.TransportClient.addTransportAddress(TransportClient.java:  
> > 197)  
> > at  
> > com.mycom.pac.elasticsearch.example.ElasticSearchExample.main(ElasticSearchExample.java:  
> > 30)
> 
> > I'm creating a TransportClient node as follows:
> 
> > TransportClient client = new  
> > TransportClient(settingsBuilder().put("cluster.name","myCluster")  
> > .put("client.transport.sniff",true))  
> > .addTransportAddress(new  
> > InetSocketTransportAddress("ec2-ip-address", 9300));
> 
> > If I remove the client.transport.sniff settings put, the client  
> > connects correctly.
> 
> > Am I doing this wrong or is it a bug of some sort?
> 
> > Thanks,  
> > Pat

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:06am UTC](https://discuss.elastic.co/t/concurrent-modification-exception-being-received/4378/4 "2017-07-06T04:06:31Z")

</div>


