Skip to content

Commit

Permalink
Synchronise the KVs list for scanner results
Browse files Browse the repository at this point in the history
Synchronises the list that holds the KeyValues that have been produced
by the scanner callbacks. The list is accessed from multiple threads at
a time and wasn't thread-safe, causing inconsistent results and partial
loss of data in the response.

Relates to: #1753
Resolves: #1760
  • Loading branch information
muffix authored and johann8384 committed Oct 26, 2020
1 parent d8527cc commit 9eaa409
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/SaltScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ final class ScannerCB implements Callback<Object,
ArrayList<ArrayList<KeyValue>>> {
private final Scanner scanner;
private final int index;
private final List<KeyValue> kvs = new ArrayList<KeyValue>();
private final List<KeyValue> kvs = Collections.synchronizedList(new ArrayList<KeyValue>());
private final ByteMap<List<Annotation>> annotations =
new ByteMap<List<Annotation>>();
private final Set<String> skips = Collections.newSetFromMap(
Expand Down

0 comments on commit 9eaa409

Please sign in to comment.