-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Calling user-defined methods within an if/else block in a lambda causes a failure #82224
Labels
>bug
:Core/Infra/Scripting
Scripting abstractions, Painless, and Mustache
>regression
Team:Core/Infra
Meta label for core/infra team
v7.15.0
v7.15.1
v7.15.2
v7.15.3
v7.16.0
v7.16.1
v7.16.2
Comments
jdconrad
added
>bug
:Core/Infra/Scripting
Scripting abstractions, Painless, and Mustache
labels
Jan 4, 2022
Pinging @elastic/es-core-infra (Team:Core/Infra) |
stu-elastic
added
>regression
v7.15.0
v7.15.1
v7.15.2
v7.15.3
v7.16.0
v7.16.1
v7.16.2
labels
Jan 4, 2022
stu-elastic
added a commit
to stu-elastic/elasticsearch
that referenced
this issue
Jan 4, 2022
If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, Propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
stu-elastic
added a commit
that referenced
this issue
Jan 4, 2022
* Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: #82224
stu-elastic
added a commit
to stu-elastic/elasticsearch
that referenced
this issue
Jan 4, 2022
…c#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
stu-elastic
added a commit
to stu-elastic/elasticsearch
that referenced
this issue
Jan 4, 2022
…c#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
stu-elastic
added a commit
to stu-elastic/elasticsearch
that referenced
this issue
Jan 4, 2022
…c#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
elasticsearchmachine
pushed a commit
that referenced
this issue
Jan 4, 2022
#82235) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: #82224
elasticsearchmachine
pushed a commit
that referenced
this issue
Jan 4, 2022
…82228) (#82237) * Script: track this pointer capture from blocks within lambdas (#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: #82224 * org.elasticsearch.core.Map.of
elasticsearchmachine
pushed a commit
that referenced
this issue
Jan 4, 2022
…82228) (#82236) * Script: track this pointer capture from blocks within lambdas (#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: #82224 * org.elasticsearch.core.Map.of
astefan
pushed a commit
to astefan/elasticsearch
that referenced
this issue
Jan 7, 2022
…c#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
astefan
pushed a commit
to astefan/elasticsearch
that referenced
this issue
Jan 7, 2022
…c#82228) * Script: track this pointer capture from blocks within lambdas If a lambda contains a block that calls into a user function, the painless compiler was not tracking that the lambda needs to capture the `this` pointer. Scripts that attempted to use a lambda that calls a user function from inside a block would trigger an `illegal_state_exception`: > no 'this' pointer within static method `BlockScope` now forwards `setUsesInstanceMethod` calls to it's parent, which may be a `LambdaScope`. `LambdaScope` will also forward `setUsesInstanceMethod` to it's parent after setting it's own `usesInstanceMethod` flag, propagating `this` pointer capture in the case of nested lambdas. Fixes: elastic#82224
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
>bug
:Core/Infra/Scripting
Scripting abstractions, Painless, and Mustache
>regression
Team:Core/Infra
Meta label for core/infra team
v7.15.0
v7.15.1
v7.15.2
v7.15.3
v7.16.0
v7.16.1
v7.16.2
It appears the "this" pointer doesn't get propagated into sub-scopes within a lambda causing a failure.
Reproduce:
Error:
no 'this' pointer within static method
Workaround:
Use control-flow logic such as if/else, for, and while to replace the lambda causing an issue.
After #74268, all user functions are instance methods, so the
this
reference needs to be propagated.The text was updated successfully, but these errors were encountered: