# Multi-threaded update crashes elasticsearch

**URL:** <https://discuss.elastic.co/t/multi-threaded-update-crashes-elasticsearch/7369>\
**Category:** Elasticsearch\
**Created:** [April 17, 2012, 7:54pm UTC](https://discuss.elastic.co/t/multi-threaded-update-crashes-elasticsearch/7369 "2012-04-17T19:54:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zmicier](https://avatars.discourse-cdn.com/v4/letter/z/ecc23a/32.png) [@Zmicier](https://discuss.elastic.co/u/Zmicier)\
**Post date:** [April 17, 2012, 7:54pm UTC](https://discuss.elastic.co/t/multi-threaded-update-crashes-elasticsearch/7369/1 "2012-04-17T19:54:42Z")

</div>

I have the following multi-threaded setup.

Several threads run in parallel and may check if the same document  
exists (using get). If it does not exist, a thread will try to create  
it (sometimes DocumentAlreadyExistsException is thrown because another  
thread has just created a document with the same id, but that's OK).

If the document exists, a thread will try to update it using a script.  
Again, there is a version conflict sometimes (I  
use .setRetryOnConflict(20) as part of the update), and that's also  
expected.

But sometimes, and this is not deterministic, a really weird error  
shows on both client and server side. Here is the error log from the  
server side:

java.lang.IllegalArgumentException: No type mapped for [122]  
at org.elasticsearch.index.translog.Translog$Operation  
$Type.fromId(Translog.java:214)  
at  
org.elasticsearch.index.translog.TranslogStreams.readSource(TranslogStreams.java:  
59)  
at  
org.elasticsearch.index.engine.robin.RobinEngine.get(RobinEngine.java:  
313)  
at  
org.elasticsearch.index.shard.service.InternalIndexShard.get(InternalIndexShard.java:  
391)  
at  
org.elasticsearch.index.get.ShardGetService.innerGet(ShardGetService.java:  
126)  
at  
org.elasticsearch.index.get.ShardGetService.get(ShardGetService.java:  
93)  
at  
org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:  
102)  
at  
org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:  
42)  
at  
org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction  
$AsyncSingleAction$1.run(TransportShardSingleOperationAction.java:156)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.runTask(ThreadPoolExecutor.java:886)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:662)

On the client side, I see

org.elasticsearch.common.util.concurrent.UncategorizedExecutionException:  
Failed execution  
at  
org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:  
88)  
at  
org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:  
49)  
.....  
Caused by: java.lang.IllegalArgumentException: No type mapped for  
[122]  
.....

There may be different numbers #N in "No type mapped for [#N]".  
Usually a block of these errors would follow, and then everything  
would return to normal. But sometimes after a block of these errors,  
elastic actually crashes.

Any ideas what is going on here?

---

<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:** [April 18, 2012, 8:22am UTC](https://discuss.elastic.co/t/multi-threaded-update-crashes-elasticsearch/7369/2 "2012-04-18T08:22:42Z")

</div>

Can you use the code you have to create a standalone testcase that we can  
easily run locally?

On Tue, Apr 17, 2012 at 10:54 PM, Zmicier [zialonka@gmail.com](mailto:zialonka@gmail.com) wrote:

> I have the following multi-threaded setup.
> 
> Several threads run in parallel and may check if the same document  
> exists (using get). If it does not exist, a thread will try to create  
> it (sometimes DocumentAlreadyExistsException is thrown because another  
> thread has just created a document with the same id, but that's OK).
> 
> If the document exists, a thread will try to update it using a script.  
> Again, there is a version conflict sometimes (I  
> use .setRetryOnConflict(20) as part of the update), and that's also  
> expected.
> 
> But sometimes, and this is not deterministic, a really weird error  
> shows on both client and server side. Here is the error log from the  
> server side:
> 
> java.lang.IllegalArgumentException: No type mapped for [122]  
> at org.elasticsearch.index.translog.Translog$Operation  
> $Type.fromId(Translog.java:214)  
> at
> 
> org.elasticsearch.index.translog.TranslogStreams.readSource(TranslogStreams.java:  
> 59)  
> at  
> org.elasticsearch.index.engine.robin.RobinEngine.get(RobinEngine.java:  
> 313)  
> at
> 
> org.elasticsearch.index.shard.service.InternalIndexShard.get(InternalIndexShard.java:  
> 391)  
> at  
> org.elasticsearch.index.get.ShardGetService.innerGet(ShardGetService.java:  
> 126)  
> at  
> org.elasticsearch.index.get.ShardGetService.get(ShardGetService.java:  
> 93)  
> at
> 
> org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:  
> 102)  
> at
> 
> org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:  
> 42)  
> at
> 
> org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction  
> $AsyncSingleAction$1.run(TransportShardSingleOperationAction.java:156)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.runTask(ThreadPoolExecutor.java:886)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:662)
> 
> On the client side, I see
> 
> org.elasticsearch.common.util.concurrent.UncategorizedExecutionException:  
> Failed execution  
> at
> 
> org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:  
> 88)  
> at
> 
> org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:  
> 49)  
> .....  
> Caused by: java.lang.IllegalArgumentException: No type mapped for  
> [122]  
> .....
> 
> There may be different numbers #N in "No type mapped for [#N]".  
> Usually a block of these errors would follow, and then everything  
> would return to normal. But sometimes after a block of these errors,  
> elastic actually crashes.
> 
> Any ideas what is going on here?

---

<div class="post-metadata">

**Author:** ![Zmicier](https://avatars.discourse-cdn.com/v4/letter/z/ecc23a/32.png) [@Zmicier](https://discuss.elastic.co/u/Zmicier)\
**Post date:** [April 18, 2012, 3:09pm UTC](https://discuss.elastic.co/t/multi-threaded-update-crashes-elasticsearch/7369/3 "2012-04-18T15:09:35Z")

</div>

It will take me a while to get a standalone test case. The threading  
and the elastic code are in very different parts of the system.

By the way, is the Client code synchronized, that is, can multiple  
threads do get/index/update simultaneously using the same Client  
instance?

On Apr 18, 4:22 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Can you use the code you have to create a standalone testcase that we can  
> easily run locally?
> 
> On Tue, Apr 17, 2012 at 10:54 PM, Zmicier [zialo...@gmail.com](mailto:zialo...@gmail.com) wrote:
> 
> > I have the following multi-threaded setup.
> 
> > Several threads run in parallel and may check if the same document  
> > exists (using get). If it does not exist, a thread will try to create  
> > it (sometimes DocumentAlreadyExistsException is thrown because another  
> > thread has just created a document with the same id, but that's OK).
> 
> > If the document exists, a thread will try to update it using a script.  
> > Again, there is a version conflict sometimes (I  
> > use .setRetryOnConflict(20) as part of the update), and that's also  
> > expected.
> 
> > But sometimes, and this is not deterministic, a really weird error  
> > shows on both client and server side. Here is the error log from the  
> > server side:
> 
> > java.lang.IllegalArgumentException: No type mapped for [122]  
> > at org.elasticsearch.index.translog.Translog$Operation  
> > $Type.fromId(Translog.java:214)  
> > at
> 
> > org.elasticsearch.index.translog.TranslogStreams.readSource(TranslogStreams .java:  
> > 59)  
> > at  
> > org.elasticsearch.index.engine.robin.RobinEngine.get(RobinEngine.java:  
> > 313)  
> > at
> 
> > org.elasticsearch.index.shard.service.InternalIndexShard.get(InternalIndexS hard.java:  
> > 391)  
> > at  
> > org.elasticsearch.index.get.ShardGetService.innerGet(ShardGetService.java:  
> > 126)  
> > at  
> > org.elasticsearch.index.get.ShardGetService.get(ShardGetService.java:  
> > 93)  
> > at
> 
> > org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGet Action.java:  
> > 102)  
> > at
> 
> > org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGet Action.java:  
> > 42)  
> > at
> 
> > org.elasticsearch.action.support.single.shard.TransportShardSingleOperation Action  
> > $AsyncSingleAction$1.run(TransportShardSingleOperationAction.java:156)  
> > at java.util.concurrent.ThreadPoolExecutor  
> > $Worker.runTask(ThreadPoolExecutor.java:886)  
> > at java.util.concurrent.ThreadPoolExecutor  
> > $Worker.run(ThreadPoolExecutor.java:908)  
> > at java.lang.Thread.run(Thread.java:662)
> 
> > On the client side, I see
> 
> > org.elasticsearch.common.util.concurrent.UncategorizedExecutionException:  
> > Failed execution  
> > at
> 
> > org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionExcept ion(AdapterActionFuture.java:  
> > 88)  
> > at
> 
> > org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActio nFuture.java:  
> > 49)  
> > .....  
> > Caused by: java.lang.IllegalArgumentException: No type mapped for  
> > [122]  
> > .....
> 
> > There may be different numbers #N in "No type mapped for [#N]".  
> > Usually a block of these errors would follow, and then everything  
> > would return to normal. But sometimes after a block of these errors,  
> > elastic actually crashes.
> 
> > Any ideas what is going on here?

---

<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:** [April 18, 2012, 4:26pm UTC](https://discuss.elastic.co/t/multi-threaded-update-crashes-elasticsearch/7369/4 "2012-04-18T16:26:33Z")

</div>

The Client code is thread safe, yes. It would be great if a  
self sufficient test case can be extracted, thanks!

On Wed, Apr 18, 2012 at 6:09 PM, Zmicier [zialonka@gmail.com](mailto:zialonka@gmail.com) wrote:

> It will take me a while to get a standalone test case. The threading  
> and the elastic code are in very different parts of the system.
> 
> By the way, is the Client code synchronized, that is, can multiple  
> threads do get/index/update simultaneously using the same Client  
> instance?
> 
> On Apr 18, 4:22 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > Can you use the code you have to create a standalone testcase that we can  
> > easily run locally?
> > 
> > On Tue, Apr 17, 2012 at 10:54 PM, Zmicier [zialo...@gmail.com](mailto:zialo...@gmail.com) wrote:
> > 
> > > I have the following multi-threaded setup.
> > 
> > > Several threads run in parallel and may check if the same document  
> > > exists (using get). If it does not exist, a thread will try to create  
> > > it (sometimes DocumentAlreadyExistsException is thrown because another  
> > > thread has just created a document with the same id, but that's OK).
> > 
> > > If the document exists, a thread will try to update it using a script.  
> > > Again, there is a version conflict sometimes (I  
> > > use .setRetryOnConflict(20) as part of the update), and that's also  
> > > expected.
> > 
> > > But sometimes, and this is not deterministic, a really weird error  
> > > shows on both client and server side. Here is the error log from the  
> > > server side:
> > 
> > > java.lang.IllegalArgumentException: No type mapped for [122]  
> > > at org.elasticsearch.index.translog.Translog$Operation  
> > > $Type.fromId(Translog.java:214)  
> > > at
> > 
> > >
> 
> org.elasticsearch.index.translog.TranslogStreams.readSource(TranslogStreams  
> .java:
> 
> > > 1. at  
> > > org.elasticsearch.index.engine.robin.RobinEngine.get(RobinEngine.java:
> > > 2. at
> > 
> > >
> 
> org.elasticsearch.index.shard.service.InternalIndexShard.get(InternalIndexS  
> hard.java:
> 
> > > 1. at
> 
> org.elasticsearch.index.get.ShardGetService.innerGet(ShardGetService.java:
> 
> > > 1. at  
> > > org.elasticsearch.index.get.ShardGetService.get(ShardGetService.java:
> > > 2. at
> > 
> > >
> 
> org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGet  
> Action.java:
> 
> > > 1. at
> > 
> > >
> 
> org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGet  
> Action.java:
> 
> > > 1. at
> > 
> > >
> 
> org.elasticsearch.action.support.single.shard.TransportShardSingleOperation  
> Action
> 
> > > $AsyncSingleAction$1.run(TransportShardSingleOperationAction.java:156)  
> > > at java.util.concurrent.ThreadPoolExecutor  
> > > $Worker.runTask(ThreadPoolExecutor.java:886)  
> > > at java.util.concurrent.ThreadPoolExecutor  
> > > $Worker.run(ThreadPoolExecutor.java:908)  
> > > at java.lang.Thread.run(Thread.java:662)
> > 
> > > On the client side, I see
> > 
> > >
> 
> org.elasticsearch.common.util.concurrent.UncategorizedExecutionException:
> 
> > > Failed execution  
> > > at
> > 
> > >
> 
> org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionExcept  
> ion(AdapterActionFuture.java:
> 
> > > 1. at
> > 
> > >
> 
> org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActio  
> nFuture.java:
> 
> > > 1. .....  
> > > Caused by: java.lang.IllegalArgumentException: No type mapped for  
> > > [122]  
> > > .....
> > 
> > > There may be different numbers #N in "No type mapped for [#N]".  
> > > Usually a block of these errors would follow, and then everything  
> > > would return to normal. But sometimes after a block of these errors,  
> > > elastic actually crashes.
> > 
> > > Any ideas what is going on here?

---

<div class="post-metadata">

**Author:** ![Zmicier](https://avatars.discourse-cdn.com/v4/letter/z/ecc23a/32.png) [@Zmicier](https://discuss.elastic.co/u/Zmicier)\
**Post date:** [April 19, 2012, 4:58pm UTC](https://discuss.elastic.co/t/multi-threaded-update-crashes-elasticsearch/7369/5 "2012-04-19T16:58:27Z")

</div>

OK, here is the smallest setup that I have that replicates my problem:

Index definition:

curl -XPOST "[http://localhost:9200/sample-index](http://localhost:9200/sample-index)" -d '  
{  
"settings" : { "number\_of\_shards" : 1, "number\_of\_replicas" : 0 },

"mappings" : {  
"sample" : {  
"properties" : {  
"names": {  
"properties" : {  
"value": { "type" : "string", "index" : "no" },  
"count": { "type" : "integer", "index" : "no" }  
}  
}  
}  
}  
}  
}  
'  
And here is the self-contained java code:

import org.elasticsearch.action.get.GetResponse;  
import org.elasticsearch.client.Client;  
import org.elasticsearch.client.transport.TransportClient;  
import org.elasticsearch.common.transport.InetSocketTransportAddress;

public class ElasticUpdateTest {

static final String updateScript =  
"int i=0; "+  
"found=false; "+  
"while (!found && i \< ctx.\_source.names.size()) { "+  
"if (ctx.\_source.names.get(i).value == name) { " +  
"found = true; " +  
"} " +  
"i++; " +  
"} "+  
"if (found) { " +  
"ctx.\_source.names.get(i-1).count += 1; " +  
"} " +  
"else { " +  
"ctx.\_source.names.add({'value' : name, 'count' : 1 }); " +  
"} ";

static final String indexName = "sample-index";

static final String indexType = "sample";

```
private static class ElasticUpdate
    implements Runnable {
    public void run() {
      for(int i = 0; i<100000;i++) {
        String name = "name"+(i % 100);
        String key = "key"+ (i % 11);
        //System.out.println("Thread 

```

"+Thread.currentThread().getName()+" updating "+key+" with name "+name);  
GetResponse getResponse = client.prepareGet(indexName,  
indexType, key).execute().actionGet();  
if (!getResponse.exists()) {  
client.prepareIndex(indexName, indexType, key).setSource("{  
"names" : }")  
.execute()  
.actionGet();  
}  
client.prepareUpdate(indexName, indexType, key)  
.setRetryOnConflict(20)  
.setScript(updateScript)  
.addScriptParam("name", name)  
.execute()  
.actionGet();  
}  
}

```
    Client client;

    ElasticUpdate (Client client) { 
      this.client = client;
    }
}

public static void main(String args[]) throws InterruptedException {
    Client client = new TransportClient()
      .addTransportAddress(new InetSocketTransportAddress("localhost", 

```

9300));

```
    int nthreads = 4;
    if (args.length > 0) {
        try {
            nthreads = Integer.parseInt(args[0]);
        } catch (NumberFormatException e) {
            System.err.println("Argument must be an integer.");
            System.exit(1);
        }
    }
    System.out.println("Starting "+nthreads+" threads");
    for(int i=0;i<nthreads;i++) {
      Thread t = new Thread(new ElasticUpdate(client));
      t.start();
    }
}

```

}

I have the standard (out-of-box) cluster setup. When I run the above  
program,  
at some point get an error like this:

Exception in thread "Thread-4"  
org.elasticsearch.common.util.concurrent.UncategorizedExecutionException:  
Failed execution  
at  
org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:88)  
at  
org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:49)  
at ElasticUpdateTest$ElasticUpdate.run(ElasticUpdateTest.java:45)  
at java.lang.Thread.run(Thread.java:662)  
Caused by: java.lang.IllegalArgumentException: No type mapped for [5]  
at  
org.elasticsearch.index.translog.Translog$Operation$Type.fromId(Translog.java:214)  
at  
org.elasticsearch.index.translog.TranslogStreams.readSource(TranslogStreams.java:59)  
at  
org.elasticsearch.index.engine.robin.RobinEngine.get(RobinEngine.java:313)  
at  
org.elasticsearch.index.shard.service.InternalIndexShard.get(InternalIndexShard.java:391)

```
    at 

```

org.elasticsearch.index.get.ShardGetService.innerGet(ShardGetService.java:126)  
at  
org.elasticsearch.index.get.ShardGetService.get(ShardGetService.java:93)  
at  
org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:102)  
at  
org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:42)  
at  
org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction$1.run(TransportShardSingleOperationAction.java:156)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
... 1 more

On Tuesday, April 17, 2012 3:54:42 PM UTC-4, Zmicier wrote:

> I have the following multi-threaded setup.
> 
> Several threads run in parallel and may check if the same document  
> exists (using get). If it does not exist, a thread will try to create  
> it (sometimes DocumentAlreadyExistsException is thrown because another  
> thread has just created a document with the same id, but that's OK).
> 
> If the document exists, a thread will try to update it using a script.  
> Again, there is a version conflict sometimes (I  
> use .setRetryOnConflict(20) as part of the update), and that's also  
> expected.
> 
> But sometimes, and this is not deterministic, a really weird error  
> shows on both client and server side. Here is the error log from the  
> server side:
> 
> java.lang.IllegalArgumentException: No type mapped for [122]  
> at org.elasticsearch.index.translog.Translog$Operation  
> $Type.fromId(Translog.java:214)  
> at  
> org.elasticsearch.index.translog.TranslogStreams.readSource(TranslogStreams.java:
> 
> 1. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.index.engine.robin.RobinEngine.get(RobinEngine.java:  
> 313)  
> at  
> org.elasticsearch.index.shard.service.InternalIndexShard.get(InternalIndexShard.java:
> 
> 1. at  
> org.elasticsearch.index.get.ShardGetService.innerGet(ShardGetService.java:
> 2. at  
> org.elasticsearch.index.get.ShardGetService.get(ShardGetService.java:
> 3. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:
> 
> 1. at  
> org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:
> 
> 2. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction
> 
> $AsyncSingleAction$1.run(TransportShardSingleOperationAction.java:156)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.runTask(ThreadPoolExecutor.java:886)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:662)
> 
> On the client side, I see
> 
> org.elasticsearch.common.util.concurrent.UncategorizedExecutionException:  
> Failed execution  
> at  
> org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:
> 
> 1. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:
> 
> 1. 
> 
> ```
> ..... 
> 
> ```
> 
> Caused by: java.lang.IllegalArgumentException: No type mapped for  
> [122]  
> .....
> 
> There may be different numbers #N in "No type mapped for [#N]".  
> Usually a block of these errors would follow, and then everything  
> would return to normal. But sometimes after a block of these errors,  
> elastic actually crashes.
> 
> Any ideas what is going on here?

---

<div class="post-metadata">

**Author:** ![Zmicier](https://avatars.discourse-cdn.com/v4/letter/z/ecc23a/32.png) [@Zmicier](https://discuss.elastic.co/u/Zmicier)\
**Post date:** [April 19, 2012, 5:07pm UTC](https://discuss.elastic.co/t/multi-threaded-update-crashes-elasticsearch/7369/6 "2012-04-19T17:07:23Z")

</div>

I have reproduced the issue with both 0.19.1 and 0.19.2

On Tuesday, April 17, 2012 3:54:42 PM UTC-4, Zmicier wrote:

> I have the following multi-threaded setup.
> 
> Several threads run in parallel and may check if the same document  
> exists (using get). If it does not exist, a thread will try to create  
> it (sometimes DocumentAlreadyExistsException is thrown because another  
> thread has just created a document with the same id, but that's OK).
> 
> If the document exists, a thread will try to update it using a script.  
> Again, there is a version conflict sometimes (I  
> use .setRetryOnConflict(20) as part of the update), and that's also  
> expected.
> 
> But sometimes, and this is not deterministic, a really weird error  
> shows on both client and server side. Here is the error log from the  
> server side:
> 
> java.lang.IllegalArgumentException: No type mapped for [122]  
> at org.elasticsearch.index.translog.Translog$Operation  
> $Type.fromId(Translog.java:214)  
> at  
> org.elasticsearch.index.translog.TranslogStreams.readSource(TranslogStreams.java:
> 
> 1. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.index.engine.robin.RobinEngine.get(RobinEngine.java:  
> 313)  
> at  
> org.elasticsearch.index.shard.service.InternalIndexShard.get(InternalIndexShard.java:
> 
> 1. at  
> org.elasticsearch.index.get.ShardGetService.innerGet(ShardGetService.java:
> 2. at  
> org.elasticsearch.index.get.ShardGetService.get(ShardGetService.java:
> 3. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:
> 
> 1. at  
> org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:
> 
> 2. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction
> 
> $AsyncSingleAction$1.run(TransportShardSingleOperationAction.java:156)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.runTask(ThreadPoolExecutor.java:886)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:662)
> 
> On the client side, I see
> 
> org.elasticsearch.common.util.concurrent.UncategorizedExecutionException:  
> Failed execution  
> at  
> org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:
> 
> 1. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:
> 
> 1. 
> 
> ```
> ..... 
> 
> ```
> 
> Caused by: java.lang.IllegalArgumentException: No type mapped for  
> [122]  
> .....
> 
> There may be different numbers #N in "No type mapped for [#N]".  
> Usually a block of these errors would follow, and then everything  
> would return to normal. But sometimes after a block of these errors,  
> elastic actually crashes.
> 
> Any ideas what is going on here?

On Tuesday, April 17, 2012 3:54:42 PM UTC-4, Zmicier wrote:

> I have the following multi-threaded setup.
> 
> Several threads run in parallel and may check if the same document  
> exists (using get). If it does not exist, a thread will try to create  
> it (sometimes DocumentAlreadyExistsException is thrown because another  
> thread has just created a document with the same id, but that's OK).
> 
> If the document exists, a thread will try to update it using a script.  
> Again, there is a version conflict sometimes (I  
> use .setRetryOnConflict(20) as part of the update), and that's also  
> expected.
> 
> But sometimes, and this is not deterministic, a really weird error  
> shows on both client and server side. Here is the error log from the  
> server side:
> 
> java.lang.IllegalArgumentException: No type mapped for [122]  
> at org.elasticsearch.index.translog.Translog$Operation  
> $Type.fromId(Translog.java:214)  
> at  
> org.elasticsearch.index.translog.TranslogStreams.readSource(TranslogStreams.java:
> 
> 1. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.index.engine.robin.RobinEngine.get(RobinEngine.java:  
> 313)  
> at  
> org.elasticsearch.index.shard.service.InternalIndexShard.get(InternalIndexShard.java:
> 
> 1. at  
> org.elasticsearch.index.get.ShardGetService.innerGet(ShardGetService.java:
> 2. at  
> org.elasticsearch.index.get.ShardGetService.get(ShardGetService.java:
> 3. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:
> 
> 1. at  
> org.elasticsearch.action.get.TransportGetAction.shardOperation(TransportGetAction.java:
> 
> 2. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction
> 
> $AsyncSingleAction$1.run(TransportShardSingleOperationAction.java:156)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.runTask(ThreadPoolExecutor.java:886)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:662)
> 
> On the client side, I see
> 
> org.elasticsearch.common.util.concurrent.UncategorizedExecutionException:  
> Failed execution  
> at  
> org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:
> 
> 1. 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:
> 
> 1. 
> 
> ```
> ..... 
> 
> ```
> 
> Caused by: java.lang.IllegalArgumentException: No type mapped for  
> [122]  
> .....
> 
> There may be different numbers #N in "No type mapped for [#N]".  
> Usually a block of these errors would follow, and then everything  
> would return to normal. But sometimes after a block of these errors,  
> elastic actually crashes.
> 
> Any ideas what is going on here?

---

<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:** [April 21, 2012, 11:55am UTC](https://discuss.elastic.co/t/multi-threaded-update-crashes-elasticsearch/7369/7 "2012-04-21T11:55:14Z")

</div>

I have run the code (thanks!) but did not manage to reproduce it yet. Whats  
the spec of the machine of the elasticsearch node you are running? I have  
opened an issue where we can track this:  
[Concurrent update failure · Issue #1877 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1877).

On Thu, Apr 19, 2012 at 8:07 PM, Zmicier [zialonka@gmail.com](mailto:zialonka@gmail.com) wrote:

> I have reproduced the issue with both 0.19.1 and 0.19.2
> 
> On Tuesday, April 17, 2012 3:54:42 PM UTC-4, Zmicier wrote:
> 
> > I have the following multi-threaded setup.
> > 
> > Several threads run in parallel and may check if the same document  
> > exists (using get). If it does not exist, a thread will try to create  
> > it (sometimes DocumentAlreadyExistsException is thrown because another  
> > thread has just created a document with the same id, but that's OK).
> > 
> > If the document exists, a thread will try to update it using a script.  
> > Again, there is a version conflict sometimes (I  
> > use .setRetryOnConflict(20) as part of the update), and that's also  
> > expected.
> > 
> > But sometimes, and this is not deterministic, a really weird error  
> > shows on both client and server side. Here is the error log from the  
> > server side:
> > 
> > java.lang.\*\*IllegalArgumentException: No type mapped for [122]  
> > at org.elasticsearch.index.\*\*translog.Translog$Operation  
> > $Type.fromId(Translog.java:\*\*214)  
> > at  
> > org.elasticsearch.index. **translog.TranslogStreams.**  
> > readSource(TranslogStreams.\*\*java:  
> > 59)  
> > at  
> > org.elasticsearch.index.\*\*engine.robin.RobinEngine.get(\*\*RobinEngine.java:
> > 
> > 1. at  
> > org.elasticsearch.index.shard.\*\*service.InternalIndexShard.\*\*get(InternalIndexShard.java:
> > 
> > 2. at  
> > org.elasticsearch.index.get.\*\*ShardGetService.innerGet(\*\*ShardGetService.java:
> > 
> > 3. at  
> > org.elasticsearch.index.get.\*\*ShardGetService.get(\*\*ShardGetService.java:
> > 
> > 4. 
> > 
> > ```
> > at
> > 
> > ```
> > 
> > org.elasticsearch.action.get.\*\*TransportGetAction.\*\*shardOperation(\*\*TransportGetAction.java:
> > 
> > 1. at  
> > org.elasticsearch.action.get.\*\*TransportGetAction.\*\*shardOperation(\*\*TransportGetAction.java:
> > 
> > 2. 
> > 
> > ```
> > at
> > 
> > ```
> > 
> > org.elasticsearch.action. **support.single.shard.**  
> > TransportShardSingleOperationA\*\*ction  
> > $AsyncSingleAction$1.run( **TransportShardSingleOperationA** ction.java:156)
> > 
> > ```
> > at java.util.concurrent.**ThreadPoolExecutor
> > 
> > ```
> > 
> > $Worker.runTask(\*\*ThreadPoolExecutor.java:886)  
> > at java.util.concurrent.\*\*ThreadPoolExecutor  
> > $Worker.run(\*\*ThreadPoolExecutor.java:908)  
> > at java.lang.Thread.run(Thread.\*\*java:662)
> > 
> > On the client side, I see
> > 
> > org.elasticsearch.common.util. **concurrent.**  
> > UncategorizedExecutionExceptio\*\*n:  
> > Failed execution  
> > at  
> > org.elasticsearch.action. **support.AdapterActionFuture.**  
> > rethrowExecutionException(\*\*AdapterActionFuture.java:  
> > 88)  
> > at  
> > org.elasticsearch.action. **support.AdapterActionFuture.**  
> > actionGet(AdapterActionFuture.\*\*java:  
> > 49)  
> > .....  
> > Caused by: java.lang.\*\*IllegalArgumentException: No type mapped for  
> > [122]  
> > .....
> > 
> > There may be different numbers #N in "No type mapped for [#N]".  
> > Usually a block of these errors would follow, and then everything  
> > would return to normal. But sometimes after a block of these errors,  
> > elastic actually crashes.
> > 
> > Any ideas what is going on here?
> 
> On Tuesday, April 17, 2012 3:54:42 PM UTC-4, Zmicier wrote:
> 
> > I have the following multi-threaded setup.
> > 
> > Several threads run in parallel and may check if the same document  
> > exists (using get). If it does not exist, a thread will try to create  
> > it (sometimes DocumentAlreadyExistsException is thrown because another  
> > thread has just created a document with the same id, but that's OK).
> > 
> > If the document exists, a thread will try to update it using a script.  
> > Again, there is a version conflict sometimes (I  
> > use .setRetryOnConflict(20) as part of the update), and that's also  
> > expected.
> > 
> > But sometimes, and this is not deterministic, a really weird error  
> > shows on both client and server side. Here is the error log from the  
> > server side:
> > 
> > java.lang.\*\*IllegalArgumentException: No type mapped for [122]  
> > at org.elasticsearch.index.\*\*translog.Translog$Operation  
> > $Type.fromId(Translog.java:\*\*214)  
> > at  
> > org.elasticsearch.index. **translog.TranslogStreams.**  
> > readSource(TranslogStreams.\*\*java:  
> > 59)  
> > at  
> > org.elasticsearch.index.\*\*engine.robin.RobinEngine.get(\*\*RobinEngine.java:
> > 
> > 1. at  
> > org.elasticsearch.index.shard.\*\*service.InternalIndexShard.\*\*get(InternalIndexShard.java:
> > 
> > 2. at  
> > org.elasticsearch.index.get.\*\*ShardGetService.innerGet(\*\*ShardGetService.java:
> > 
> > 3. at  
> > org.elasticsearch.index.get.\*\*ShardGetService.get(\*\*ShardGetService.java:
> > 
> > 4. 
> > 
> > ```
> > at
> > 
> > ```
> > 
> > org.elasticsearch.action.get.\*\*TransportGetAction.\*\*shardOperation(\*\*TransportGetAction.java:
> > 
> > 1. at  
> > org.elasticsearch.action.get.\*\*TransportGetAction.\*\*shardOperation(\*\*TransportGetAction.java:
> > 
> > 2. 
> > 
> > ```
> > at
> > 
> > ```
> > 
> > org.elasticsearch.action. **support.single.shard.**  
> > TransportShardSingleOperationA\*\*ction  
> > $AsyncSingleAction$1.run( **TransportShardSingleOperationA** ction.java:156)
> > 
> > ```
> > at java.util.concurrent.**ThreadPoolExecutor
> > 
> > ```
> > 
> > $Worker.runTask(\*\*ThreadPoolExecutor.java:886)  
> > at java.util.concurrent.\*\*ThreadPoolExecutor  
> > $Worker.run(\*\*ThreadPoolExecutor.java:908)  
> > at java.lang.Thread.run(Thread.\*\*java:662)
> > 
> > On the client side, I see
> > 
> > org.elasticsearch.common.util. **concurrent.**  
> > UncategorizedExecutionExceptio\*\*n:  
> > Failed execution  
> > at  
> > org.elasticsearch.action. **support.AdapterActionFuture.**  
> > rethrowExecutionException(\*\*AdapterActionFuture.java:  
> > 88)  
> > at  
> > org.elasticsearch.action. **support.AdapterActionFuture.**  
> > actionGet(AdapterActionFuture.\*\*java:  
> > 49)  
> > .....  
> > Caused by: java.lang.\*\*IllegalArgumentException: No type mapped for  
> > [122]  
> > .....
> > 
> > There may be different numbers #N in "No type mapped for [#N]".  
> > Usually a block of these errors would follow, and then everything  
> > would return to normal. But sometimes after a block of these errors,  
> > elastic actually crashes.
> > 
> > Any ideas what is going on here?

---

<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, 3:31am UTC](https://discuss.elastic.co/t/multi-threaded-update-crashes-elasticsearch/7369/8 "2017-07-06T03:31:32Z")

</div>


