-
Notifications
You must be signed in to change notification settings - Fork 140
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
restore thread context before running action listener #1418
Conversation
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
@@ -225,14 +225,14 @@ void registerModel(ActionListener<MLRegisterModelResponse> listener) throws Inte | |||
XContentBuilder builder = XContentBuilder.builder(XContentType.JSON.xContent()); | |||
modelGroup.toXContent(builder, ToXContent.EMPTY_PARAMS); | |||
createModelGroupRequest.source(builder); | |||
client.index(createModelGroupRequest, ActionListener.wrap(r -> { | |||
client.index(createModelGroupRequest, ActionListener.runBefore(ActionListener.wrap(r -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we should add a similar comment in the code also what you have in the PR?
Codecov Report
@@ Coverage Diff @@
## 2.9 #1418 +/- ##
============================================
+ Coverage 78.72% 78.76% +0.03%
- Complexity 2140 2153 +13
============================================
Files 168 168
Lines 8756 8767 +11
Branches 878 878
============================================
+ Hits 6893 6905 +12
+ Misses 1463 1462 -1
Partials 400 400
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…ject#1418) Signed-off-by: Yaliang Wu <ylwu@amazon.com>
…ject#1418) (opensearch-project#1422) (opensearch-project#1435) Signed-off-by: Yaliang Wu <ylwu@amazon.com> (cherry picked from commit 9359487) Co-authored-by: Yaliang Wu <ylwu@amazon.com> Signed-off-by: TrungBui59 <bui23@purdue.edu>
Description
We see reindex will throw error "wrong user in reader context". That's because after stashing thread context, the user info will be gone. Security plugin will recheck user info when reindex, then throw this error. We should restore thread context before running action listener.
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.