You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/01/04 20:22:02 UTC

[GitHub] [lucene-solr] muse-dev[bot] commented on a change in pull request #2153: LUCENE-9570: A non-mergable PR with reformatted code.

muse-dev[bot] commented on a change in pull request #2153:
URL: https://github.com/apache/lucene-solr/pull/2153#discussion_r551547661



##########
File path: lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java
##########
@@ -305,20 +298,25 @@ public synchronized boolean store(DataOutput output) throws IOException {
   @Override
   public synchronized boolean load(DataInput input) throws IOException {
     count = input.readVLong();
-    this.higherWeightsCompletion = new FSTCompletion(new FST<>(
-        input, input, NoOutputs.getSingleton()));
-    this.normalCompletion = new FSTCompletion(
-        higherWeightsCompletion.getFST(), false, exactMatchFirst);
+    this.higherWeightsCompletion =
+        new FSTCompletion(new FST<>(input, input, NoOutputs.getSingleton()));
+    this.normalCompletion =
+        new FSTCompletion(higherWeightsCompletion.getFST(), false, exactMatchFirst);
     return true;
   }
 
   @Override
   public long ramBytesUsed() {
-    long mem = RamUsageEstimator.shallowSizeOf(this) + RamUsageEstimator.shallowSizeOf(normalCompletion) + RamUsageEstimator.shallowSizeOf(higherWeightsCompletion);
+    long mem =
+        RamUsageEstimator.shallowSizeOf(this)
+            + RamUsageEstimator.shallowSizeOf(normalCompletion)

Review comment:
       *THREAD_SAFETY_VIOLATION:*  Read/Write race. Non-private method `FSTCompletionLookup.ramBytesUsed()` reads without synchronization from `this.normalCompletion`. Potentially races with write in method `FSTCompletionLookup.load(...)`.
    Reporting because another access to the same memory occurs on a background thread, although this access may not.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org