-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Ensure to access RecoveryState#fileDetails under lock #43839
Conversation
…0 locations, but not in 1 (the 21st) location.
@paulward24 Can you please sign CLA? Thank you for reporting and working on this issue. |
Pinging @elastic/es-distributed |
I signed the CLA. Thanks for pointing this out! |
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.
LGTM
@elasticmachine test this please |
1 similar comment
@elasticmachine test this please |
Jenkins run elasticsearch-ci/1 |
I see 2 tests failing. I don't know why this would happen, but it seems unlikely that they fail from this patch. I.e., the patch is just synchronizing the get() of a HashMap --- there is nothing to deadlock or break there. I am not familiar with the internals of ElasticSearch to be able to debug those two tests Nhat, can you please take a look? Thanks!! |
I think the fix for the failures here is incoming in #43861 |
@paulward24 could you merge |
@elasticmachine update branch |
I see this "@elasticmachine update branch" from Nhat. Should I still do the merge? |
Yes. please merge master into your branch. Thank you! |
Ok, I did --- how do I update this CR ? |
@elasticmachine test this please |
1 similar comment
@elasticmachine test this please |
ok, I don't know why these tests fail. Unlikely to be related to the patch |
Jenkins test this (@paulward24 yea the failures are the result of a temporary infrastructure issue we were experiencing, let's see if it passed :)) |
Jenkins run elasticsearch-ci/packaging-sample |
@paulward24 Thanks again for working on this :). |
Thank you Nhat and Armin for all the hard work on this! |
The field
fileDetails
(aHashMap
, i.e., not thread safe)https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java#L679
is used only in synchronzied methods (in about 20 locations), e.g.,:
https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java#L767-L768
i.e., including
.size()
.This is correct, because according to JDK:
https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html
However, in the 21st location, here:
https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java#L958
the method is not synchronized.
This CR simply adds the keyword synchronized to the method, just like for all the other places.