Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XContentBuilder: Avoid building self-referencing objects #20550

Merged
merged 1 commit into from Oct 11, 2016

Conversation

Projects
None yet
4 participants
@tlrx
Copy link
Member

commented Sep 19, 2016

Some objects like maps, iterables or arrays of objects can self-reference themselves. This is mostly due to a bug in code but the XContentBuilder should be able to detect such situations and throws an IllegalArgumentException instead of building objects over and over until a stackoverflow occurs.

closes #20540
closes #19475

@jpountz
Copy link
Contributor

left a comment

I like the idea but on the other hand I can see this causing issues too. For instance it forces to keep objects that are used to build the xcontent around until the builder is closed. The other thing we should look into is whether this has an impact on performance.

core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java Outdated
* Keeps around a list of objects that have been built. This list is checked whenever a map/list/iterable object
* is built to avoid endless loops when building objects that self-reference themselves.
*/
private final List<Object> ancestors = new ArrayList<>();

This comment has been minimized.

Copy link
@jpountz

jpountz Sep 19, 2016

Contributor

This should probably be an IdentityHashSet.

This comment has been minimized.

Copy link
@tlrx

tlrx Sep 19, 2016

Author Member

I didn't know about this one, thanks

core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java Outdated
if (ancestors.contains(value)) {
throw new IllegalArgumentException("Object has already been built and is self-referencing itself");
}
ancestors.add(value);

This comment has been minimized.

Copy link
@jpountz

jpountz Sep 19, 2016

Contributor

could be just if (ancestors.add(value) == false) when moving to a set

core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java Outdated
return value(values);
}

private XContentBuilder value(Map<String, ?> values) throws IOException {

This comment has been minimized.

Copy link
@jpountz

jpountz Sep 19, 2016

Contributor

why does the split help?

This comment has been minimized.

Copy link
@tlrx

tlrx Sep 19, 2016

Author Member

Oh, it's a leftover.

@tlrx

This comment has been minimized.

Copy link
Member Author

commented Sep 19, 2016

@jpountz Thanks for your review, I updated the code.

I like the idea but on the other hand I can see this causing issues too. For instance it forces to keep objects that are used to build the xcontent around until the builder is closed.

Yes, it is not ideal but I don't see how we could prevent endless recursive calls without it.

The other thing we should look into is whether this has an impact on performance.

It will have some impact but I don't expect it to be big. I can run some Rally tests if you find the idea of keeping objects around acceptable...?

@jpountz

This comment has been minimized.

Copy link
Contributor

commented Sep 19, 2016

For instance it forces to keep objects that are used to build the xcontent around until the builder is closed.

Yes, it is not ideal but I don't see how we could prevent endless recursive calls without it.

I am a bit torn about the benefit of adding this protection vs. the potential problems that retaining objects could cause. @jasontedor Maybe you have an opinion about this?

It will have some impact but I don't expect it to be big. I can run some Rally tests if you find the idea of keeping objects around acceptable...?

For that part, I'd also be fine with just watching the nightly benchmarks to see whether there is a noticeable slow down, just wanted to mention it as I have no idea how much xcontent building is used at index time. At search time, I am pretty sure this change would be ok.

@clintongormley

This comment has been minimized.

Copy link
Member

commented Sep 20, 2016

Tried out this PR against master and it causes problems. Try running the following:

PUT t/t/1 
{}

GET _search
{
  "script_fields": {
    "FIELD": {
      "script": {
        "lang": "painless",
        "inline": "while (true) {}"
      }
    }
  }
}

The second request hangs and the logs show:

[elasticsearch] [2016-09-20T11:17:03,253][INFO ][o.e.c.m.MetaDataCreateIndexService] [od38nkP] [t] creating index, cause [auto(index api)], templates [], shards [5]/[1], mappings []
[elasticsearch] [2016-09-20T11:17:03,529][INFO ][o.e.c.m.MetaDataMappingService] [od38nkP] [t/1o_LC2B5RSmfcCOQuMo7TQ] create_mapping [t]
[elasticsearch] [2016-09-20T11:17:20,963][DEBUG][o.e.a.s.TransportSearchAction] [od38nkP] [t][3], node[od38nkPUS6qGK4lVOJt7xA], [P], s[STARTED], a[id=Ym46EKCuQi-9Ulp2tUcmNw]: Failed to execute [SearchRequest{searchType=QUERY_THEN_FETCH, indices=[], indicesOptions=IndicesOptions[id=38, ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, allow_alisases_to_multiple_indices=true, forbid_closed_indices=true], types=[], routing='null', preference='null', requestCache=null, scroll=null, source={
[elasticsearch]   "script_fields" : {
[elasticsearch]     "FIELD" : {
[elasticsearch]       "script" : {
[elasticsearch]         "inline" : "while (true) {}",
[elasticsearch]         "lang" : "painless"
[elasticsearch]       },
[elasticsearch]       "ignore_failure" : false
[elasticsearch]     }
[elasticsearch]   },
[elasticsearch]   "ext" : { }
[elasticsearch] }}]
[elasticsearch] org.elasticsearch.transport.RemoteTransportException: [od38nkP][127.0.0.1:9300][indices:data/read/search[phase/query]]
[elasticsearch] Caused by: org.elasticsearch.script.ScriptException: compile error
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.convertToScriptException(PainlessScriptEngineService.java:264) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:176) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
[elasticsearch] Caused by: java.lang.IllegalArgumentException: While loop has no escape.
[elasticsearch]         at org.elasticsearch.painless.Executable$Script.compile(while (true) {} @ <inline script>:1) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SWhile.analyze(SWhile.java:74) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:190) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:162) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.Compiler.compile(Compiler.java:104) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:171) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_73]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_73]
[elasticsearch] [2016-09-20T11:17:20,959][DEBUG][o.e.a.s.TransportSearchAction] [od38nkP] [t][0], node[od38nkPUS6qGK4lVOJt7xA], [P], s[STARTED], a[id=LagGIpbwQ8eEuBOaRurFxg]: Failed to execute [SearchRequest{searchType=QUERY_THEN_FETCH, indices=[], indicesOptions=IndicesOptions[id=38, ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, allow_alisases_to_multiple_indices=true, forbid_closed_indices=true], types=[], routing='null', preference='null', requestCache=null, scroll=null, source={
[elasticsearch]   "script_fields" : {
[elasticsearch]     "FIELD" : {
[elasticsearch]       "script" : {
[elasticsearch]         "inline" : "while (true) {}",
[elasticsearch]         "lang" : "painless"
[elasticsearch]       },
[elasticsearch]       "ignore_failure" : false
[elasticsearch]     }
[elasticsearch]   },
[elasticsearch]   "ext" : { }
[elasticsearch] }}] lastShard [true]
[elasticsearch] org.elasticsearch.transport.RemoteTransportException: [od38nkP][127.0.0.1:9300][indices:data/read/search[phase/query]]
[elasticsearch] Caused by: org.elasticsearch.script.ScriptException: compile error
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.convertToScriptException(PainlessScriptEngineService.java:264) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:176) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
[elasticsearch] Caused by: java.lang.IllegalArgumentException: While loop has no escape.
[elasticsearch]         at org.elasticsearch.painless.Executable$Script.compile(while (true) {} @ <inline script>:1) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SWhile.analyze(SWhile.java:74) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:190) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:162) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.Compiler.compile(Compiler.java:104) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:171) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_73]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_73]
[elasticsearch] [2016-09-20T11:17:20,955][DEBUG][o.e.a.s.TransportSearchAction] [od38nkP] [t][1], node[od38nkPUS6qGK4lVOJt7xA], [P], s[STARTED], a[id=ILZq67vnSBucWOe7OlhAzA]: Failed to execute [SearchRequest{searchType=QUERY_THEN_FETCH, indices=[], indicesOptions=IndicesOptions[id=38, ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, allow_alisases_to_multiple_indices=true, forbid_closed_indices=true], types=[], routing='null', preference='null', requestCache=null, scroll=null, source={
[elasticsearch]   "script_fields" : {
[elasticsearch]     "FIELD" : {
[elasticsearch]       "script" : {
[elasticsearch]         "inline" : "while (true) {}",
[elasticsearch]         "lang" : "painless"
[elasticsearch]       },
[elasticsearch]       "ignore_failure" : false
[elasticsearch]     }
[elasticsearch]   },
[elasticsearch]   "ext" : { }
[elasticsearch] }}] lastShard [true]
[elasticsearch] org.elasticsearch.transport.RemoteTransportException: [od38nkP][127.0.0.1:9300][indices:data/read/search[phase/query]]
[elasticsearch] Caused by: org.elasticsearch.script.ScriptException: compile error
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.convertToScriptException(PainlessScriptEngineService.java:264) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:176) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
[elasticsearch] Caused by: java.lang.IllegalArgumentException: While loop has no escape.
[elasticsearch]         at org.elasticsearch.painless.Executable$Script.compile(while (true) {} @ <inline script>:1) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SWhile.analyze(SWhile.java:74) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:190) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:162) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.Compiler.compile(Compiler.java:104) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:171) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_73]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_73]
[elasticsearch] [2016-09-20T11:17:20,955][DEBUG][o.e.a.s.TransportSearchAction] [od38nkP] [t][4], node[od38nkPUS6qGK4lVOJt7xA], [P], s[STARTED], a[id=mWpdJMDJSpyizNdZTODSCA]: Failed to execute [SearchRequest{searchType=QUERY_THEN_FETCH, indices=[], indicesOptions=IndicesOptions[id=38, ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, allow_alisases_to_multiple_indices=true, forbid_closed_indices=true], types=[], routing='null', preference='null', requestCache=null, scroll=null, source={
[elasticsearch]   "script_fields" : {
[elasticsearch]     "FIELD" : {
[elasticsearch]       "script" : {
[elasticsearch]         "inline" : "while (true) {}",
[elasticsearch]         "lang" : "painless"
[elasticsearch]       },
[elasticsearch]       "ignore_failure" : false
[elasticsearch]     }
[elasticsearch]   },
[elasticsearch]   "ext" : { }
[elasticsearch] }}] lastShard [true]
[elasticsearch] org.elasticsearch.transport.RemoteTransportException: [od38nkP][127.0.0.1:9300][indices:data/read/search[phase/query]]
[elasticsearch] Caused by: org.elasticsearch.script.ScriptException: compile error
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.convertToScriptException(PainlessScriptEngineService.java:264) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:176) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
[elasticsearch] Caused by: java.lang.IllegalArgumentException: While loop has no escape.
[elasticsearch]         at org.elasticsearch.painless.Executable$Script.compile(while (true) {} @ <inline script>:1) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SWhile.analyze(SWhile.java:74) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:190) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:162) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.Compiler.compile(Compiler.java:104) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:171) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_73]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_73]
[elasticsearch] [2016-09-20T11:17:20,972][DEBUG][o.e.a.s.TransportSearchAction] [od38nkP] All shards failed for phase: [query]
[elasticsearch] org.elasticsearch.transport.RemoteTransportException: [od38nkP][127.0.0.1:9300][indices:data/read/search[phase/query]]
[elasticsearch] Caused by: org.elasticsearch.script.ScriptException: compile error
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.convertToScriptException(PainlessScriptEngineService.java:264) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:176) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
[elasticsearch] Caused by: java.lang.IllegalArgumentException: While loop has no escape.
[elasticsearch]         at org.elasticsearch.painless.Executable$Script.compile(while (true) {} @ <inline script>:1) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SWhile.analyze(SWhile.java:74) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:190) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:162) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.Compiler.compile(Compiler.java:104) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:171) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_73]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_73]
[elasticsearch] [2016-09-20T11:17:20,956][DEBUG][o.e.a.s.TransportSearchAction] [od38nkP] [t][2], node[od38nkPUS6qGK4lVOJt7xA], [P], s[STARTED], a[id=qIRetOuwShW0KbrA7gN14A]: Failed to execute [SearchRequest{searchType=QUERY_THEN_FETCH, indices=[], indicesOptions=IndicesOptions[id=38, ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, allow_alisases_to_multiple_indices=true, forbid_closed_indices=true], types=[], routing='null', preference='null', requestCache=null, scroll=null, source={
[elasticsearch]   "script_fields" : {
[elasticsearch]     "FIELD" : {
[elasticsearch]       "script" : {
[elasticsearch]         "inline" : "while (true) {}",
[elasticsearch]         "lang" : "painless"
[elasticsearch]       },
[elasticsearch]       "ignore_failure" : false
[elasticsearch]     }
[elasticsearch]   },
[elasticsearch]   "ext" : { }
[elasticsearch] }}] lastShard [true]
[elasticsearch] org.elasticsearch.transport.RemoteTransportException: [od38nkP][127.0.0.1:9300][indices:data/read/search[phase/query]]
[elasticsearch] Caused by: org.elasticsearch.script.ScriptException: compile error
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.convertToScriptException(PainlessScriptEngineService.java:264) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:176) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
[elasticsearch] Caused by: java.lang.IllegalArgumentException: While loop has no escape.
[elasticsearch]         at org.elasticsearch.painless.Executable$Script.compile(while (true) {} @ <inline script>:1) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SWhile.analyze(SWhile.java:74) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:190) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:162) ~[?:?]
[elasticsearch]  :distriat org.elasticsearch.painless.Compiler.compile(Compiler.java:104) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:171) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_73]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_73]
[elasticsearch] [2016-09-20T11:17:20,979][WARN ][r.suppressed             ] path: /_search, params: {}
[elasticsearch] org.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed
[elasticsearch]         at org.elasticsearch.action.search.AbstractSearchAsyncAction.onFirstPhaseResult(AbstractSearchAsyncAction.java:235) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:170) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:51) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:954) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1055) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1033) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.onFailure(TransportService.java:559) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.onFailure(ThreadContext.java:490) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
[elasticsearch] Caused by: org.elasticsearch.transport.RemoteTransportException: [od38nkP][127.0.0.1:9300][indices:data/read/search[phase/query]]
[elasticsearch] Caused by: org.elasticsearch.script.ScriptException: compile error
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.convertToScriptException(PainlessScriptEngineService.java:264) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:176) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         ... 3 more
[elasticsearch] Caused by: java.lang.IllegalArgumentException: While loop has no escape.
[elasticsearch]         at org.elasticsearch.painless.Executable$Script.compile(while (true) {} @ <inline script>:1) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SWhile.analyze(SWhile.java:74) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:190) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.node.SSource.analyze(SSource.java:162) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.Compiler.compile(Compiler.java:104) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:171) ~[?:?]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_73]
[elasticsearch]         at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         ... 3 more
[elasticsearch] [2016-09-20T11:17:21,116][ERROR][o.e.r.a.RestResponseListener] failed to send failure response
[elasticsearch] java.lang.IllegalArgumentException: Object has already been built and is self-referencing itself
[elasticsearch]         at org.elasticsearch.common.xcontent.XContentBuilder.ensureNotSeen(XContentBuilder.java:1021) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.xcontent.XContentBuilder.value(XContentBuilder.java:890) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.xcontent.XContentBuilder.field(XContentBuilder.java:883) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.script.ScriptException.innerToXContent(ScriptException.java:92) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.ElasticsearchException.toXContent(ElasticsearchException.java:243) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.ElasticsearchException.toXContent(ElasticsearchException.java:310) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.ShardSearchFailure.toXContent(ShardSearchFailure.java:164) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.SearchPhaseExecutionException.innerToXContent(SearchPhaseExecutionException.java:143) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.ElasticsearchException.toXContent(ElasticsearchException.java:243) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.ElasticsearchException.toXContent(ElasticsearchException.java:310) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.rest.BytesRestResponse.convert(BytesRestResponse.java:146) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.rest.BytesRestResponse.<init>(BytesRestResponse.java:92) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.rest.BytesRestResponse.<init>(BytesRestResponse.java:83) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.rest.action.RestActionListener.onFailure(RestActionListener.java:58) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.support.TransportAction$1.onFailure(TransportAction.java:97) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.support.TransportAction$FilteredActionListener.onFailure(TransportAction.java:254) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.AbstractSearchAsyncAction.raiseEarlyFailure(AbstractSearchAsyncAction.java:329) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.AbstractSearchAsyncAction.onFirstPhaseResult(AbstractSearchAsyncAction.java:235) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:170) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:51) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:954) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1055) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1033) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.transport.TransportService$6.onFailure(TransportService.java:559) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.onFailure(ThreadContext.java:490) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_73]
[elasticsearch]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_73]
[elasticsearch]         at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
[elasticsearch]         Suppressed: org.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed
[elasticsearch]           at org.elasticsearch.action.search.AbstractSearchAsyncAction.onFirstPhaseResult(AbstractSearchAsyncAction.java:235) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:170) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:51) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:954) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1055) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1033) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.transport.TransportService$6.onFailure(TransportService.java:559) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.onFailure(ThreadContext.java:490) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_73]
[elasticsearch]           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_73]
[elasticsearch]           at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
[elasticsearch]         Caused by: org.elasticsearch.transport.RemoteTransportException: [od38nkP][127.0.0.1:9300][indices:data/read/search[phase/query]]
[elasticsearch]         Caused by: org.elasticsearch.script.ScriptException: compile error
[elasticsearch]           at org.elasticsearch.painless.PainlessScriptEngineService.convertToScriptException(PainlessScriptEngineService.java:264) ~[?:?]
[elasticsearch]           at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:176) ~[?:?]
[elasticsearch]           at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           ... 3 more
[elasticsearch]         Caused by: java.lang.IllegalArgumentException: While loop has no escape.
[elasticsearch]           at org.elasticsearch.painless.Executable$Script.compile(while (true) {} @ <inline script>:1) ~[?:?]
[elasticsearch]           at org.elasticsearch.painless.node.SWhile.analyze(SWhile.java:74) ~[?:?]
[elasticsearch]           at org.elasticsearch.painless.node.SSource.analyze(SSource.java:190) ~[?:?]
[elasticsearch]           at org.elasticsearch.painless.node.SSource.analyze(SSource.java:162) ~[?:?]
[elasticsearch]           at org.elasticsearch.painless.Compiler.compile(Compiler.java:104) ~[?:?]
[elasticsearch]           at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:171) ~[?:?]
[elasticsearch]           at org.elasticsearch.painless.PainlessScriptEngineService$2.run(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]           at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_73]
[elasticsearch]           at org.elasticsearch.painless.PainlessScriptEngineService.compile(PainlessScriptEngineService.java:168) ~[?:?]
[elasticsearch]           at org.elasticsearch.script.ScriptService.compileInternal(ScriptService.java:339) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.script.ScriptService.compile(ScriptService.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.script.ScriptService.search(ScriptService.java:490) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.search.SearchService.parseSource(SearchService.java:738) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.search.SearchService.createContext(SearchService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:242) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$667(SearchTransportService.java:276) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:548) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
[elasticsearch]           ... 3 more

@tlrx tlrx force-pushed the tlrx:do-not-build-self-referencing-objects branch Sep 22, 2016

@tlrx

This comment has been minimized.

Copy link
Member Author

commented Sep 22, 2016

@jpountz I changed this PR to try something slightly different. It now checks the map before building it. This way it only keeps objects references during the check. It is still not perfect but I'd like to have your opinion on this. Thanks

@jpountz
Copy link
Contributor

left a comment

I like it better. I left a couple comments.

core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java Outdated
} else if ((value instanceof Iterable) && (value instanceof Path == false)) {
it = ((Iterable) value).iterator();
} else if (value instanceof Object[]) {
it = new Iterator<Object>() {

This comment has been minimized.

Copy link
@jpountz

jpountz Sep 23, 2016

Contributor

let's use Arrays.asList?

This comment has been minimized.

Copy link
@jpountz

jpountz Sep 23, 2016

Contributor

actually it would be easier to create an iterable than in iterator I think?

This comment has been minimized.

Copy link
@tlrx

tlrx Oct 10, 2016

Author Member

Yes

core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java Outdated
return array[index++];
}
};
}

This comment has been minimized.

Copy link
@jpountz

jpountz Sep 23, 2016

Contributor

let's throw an exception in the else clause since it should never happen if I read the rest of the code correctly?

This comment has been minimized.

Copy link
@jpountz

jpountz Sep 23, 2016

Contributor

and remove the below null check

This comment has been minimized.

Copy link
@jpountz

jpountz Sep 23, 2016

Contributor

otherwise I would be happy to just return in the else block and remove the instanceof check in the while loop below

This comment has been minimized.

Copy link
@tlrx

tlrx Oct 10, 2016

Author Member

Makes sense, thanks

@tlrx tlrx force-pushed the tlrx:do-not-build-self-referencing-objects branch Oct 10, 2016

@tlrx

This comment has been minimized.

Copy link
Member Author

commented Oct 10, 2016

@jpountz I updated the code according to your comments. Can you please have another look? Thanks

@jpountz
Copy link
Contributor

left a comment

I left one minor comment, otherwise LGTM.

core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java Outdated
private static void ensureNoSelfReferences(final Object value, final Set<Object> ancestors) {
if (value != null) {

Iterable it;

This comment has been minimized.

Copy link
@jpountz

jpountz Oct 10, 2016

Contributor

can you use wildcard generics to avoid compiler warnings? (Iterable<?>)

This comment has been minimized.

Copy link
@tlrx

tlrx Oct 11, 2016

Author Member

Sure

XContentBuilder: Avoid building self-referencing objects
Some objects like maps, iterables or arrays of objects can self-reference themselves. This is mostly due to a bug in code but the XContentBuilder should be able to detect such situations and throws an IllegalArgumentException instead of building objects over and over until a stackoverflow occurs.

closes #20540
closes #19475

@tlrx tlrx force-pushed the tlrx:do-not-build-self-referencing-objects branch to 680b69c Oct 11, 2016

@tlrx

This comment has been minimized.

Copy link
Member Author

commented Oct 11, 2016

retest this please

@jpountz
Copy link
Contributor

left a comment

LGTM

@tlrx tlrx merged commit e4c7d81 into elastic:master Oct 11, 2016

2 checks passed

CLA Commit author is a member of Elasticsearch
Details
elasticsearch-ci Build finished.
Details
@tlrx

This comment has been minimized.

Copy link
Member Author

commented Oct 11, 2016

Thanks @jpountz

@s1monw

This comment has been minimized.

Copy link
Contributor

commented Oct 11, 2016

I wonder if we should only do this when assertions are enabled? it looks like there are many recursions happening etc.

@jpountz

This comment has been minimized.

Copy link
Contributor

commented Oct 11, 2016

The point seems to be about avoiding the stack overflow on production clusters, so I don't think only doing it when assertions are on would help?

@tlrx

This comment has been minimized.

Copy link
Member Author

commented Oct 11, 2016

Assertions are enabled only for tests, right? Here we want to throw an exception if we know that the XContentBuilder is going to enter an infinite recursive state when building a self-referencing map at runtime.

@s1monw

This comment has been minimized.

Copy link
Contributor

commented Oct 11, 2016

fair enough

@tlrx tlrx added the v5.1.1 label Oct 11, 2016

@tlrx tlrx deleted the tlrx:do-not-build-self-referencing-objects branch Oct 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.