HashMap is is not thread safe. Field fileDetails is synchronized in 20 locations, but not in 1 (the 21st) location #43840
Labels
>bug
:Distributed Indexing/Recovery
Anything around constructing a new shard, either from a local or a remote source.
I submitted a CR for this issue:
#43839
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.
The text was updated successfully, but these errors were encountered: