-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Core/Infra/ScriptingScripting abstractions, Painless, and MustacheScripting abstractions, Painless, and Mustache>bug
Description
Elasticsearch version:
5.0.0-alpha4
JVM version:
Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_101/25.101-b13
OS version:
Linux 107r01pc 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Description of the problem including expected versus actual behavior:
In a groovy scripted update asserting while referencing variables and specifying a message will cause a class not found exception.
Steps to reproduce:
- on a clean elasticsearch enable scripting
- run some curl commands, see below
- observe the results
Various commands:
curl -XPOST 'http://localhost:9200/a/a/a/_update' -d '{"scripted_upsert": true, "script": {"inline": "assert false, \"foo\";"}, "upsert": {}}'{"error":{"root_cause":[{"type":"remote_transport_exception","reason":"[Vertigo][127.0.0.1:9300][indices:data/write/update[s]]"}],"type":"illegal_argument_exception","reason":"failed to execute script","caused_by":{"type":"script_exception","reason":"Error evaluating assert false, \"foo\";","caused_by":{"type":"assertion_error","reason":"foo. Expression: false"},"script_stack":[],"script":"","lang":"groovy"}},"status":400}
curl -XPOST 'http://localhost:9200/a/a/b/_update' -d '{"scripted_upsert": true, "script": {"inline": "def bar=false; assert bar, \"foo\";"}, "upsert": {}}'{"error":{"root_cause":[{"type":"remote_transport_exception","reason":"[Vertigo][127.0.0.1:9300][indices:data/write/update[s]]"}],"type":"illegal_argument_exception","reason":"failed to execute script","caused_by":{"type":"script_exception","reason":"Error evaluating def bar=false; assert bar, \"foo\";","caused_by":{"type":"no_class_def_found_error","reason":"java/lang/StringBuffer"},"script_stack":[],"script":"","lang":"groovy"}},"status":400}
curl -XPOST 'http://localhost:9200/a/a/b/_update' -d '{"scripted_upsert": true, "script": {"inline": "def bar=false; assert bar;"}, "upsert": {}}'{"error":{"root_cause":[{"type":"remote_transport_exception","reason":"[Vertigo][127.0.0.1:9300][indices:data/write/update[s]]"}],"type":"illegal_argument_exception","reason":"failed to execute script","caused_by":{"type":"script_exception","reason":"Error evaluating def bar=false; assert bar;","caused_by":{"type":"power_assertion_error","reason":"assert bar\n |\n false"},"script_stack":[],"script":"","lang":"groovy"}},"status":400}
Somewhat more clearly:
- using
assert false, "message"works as expected - using
assert var, "message"throws a class not found exception somewhere down the stack - using
assert varworks as expected
I've tried this on a more recent snapshot (34bb150) and the assert shows up in the log, but curl never prints anything nor exists, as if no response is generated.
This is the log:
[2016-08-04 18:07:53,886][ERROR][bootstrap ] [] fatal error in thread [elasticsearch[0ZFv9t-][index][T#1]], exiting
java.lang.AssertionError: foo. Expression: false
at org.codehaus.groovy.runtime.InvokerHelper.assertFailed(InvokerHelper.java:404)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.assertFailed(ScriptBytecodeAdapter.java:650)
at 20a61a940854553b62db2cfb00cb1511e91aac90.run(20a61a940854553b62db2cfb00cb1511e91aac90:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.elasticsearch.script.groovy.GroovyScriptEngineService$GroovyScript.run(GroovyScriptEngineService.java:295)
at org.elasticsearch.action.update.UpdateHelper.executeScript(UpdateHelper.java:253)
at org.elasticsearch.action.update.UpdateHelper.prepare(UpdateHelper.java:103)
at org.elasticsearch.action.update.UpdateHelper.prepare(UpdateHelper.java:80)
at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:179)
at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:172)
at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:69)
at org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction$ShardTransportHandler.messageReceived(TransportInstanceSingleOperationAction.java:247)
at org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction$ShardTransportHandler.messageReceived(TransportInstanceSingleOperationAction.java:243)
at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)
at org.elasticsearch.transport.TransportService$5.doRun(TransportService.java:517)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:510)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Exception: java.security.AccessControlException thrown from the UncaughtExceptionHandler in thread "elasticsearch[0ZFv9t-][index][T#1]"
Metadata
Metadata
Assignees
Labels
:Core/Infra/ScriptingScripting abstractions, Painless, and MustacheScripting abstractions, Painless, and Mustache>bug