sjvanrossum commented on PR #39556:
URL: https://github.com/apache/beam/pull/39556#issuecomment-5130227034

   @stankiewicz this looks like a false positive.
   This test passes, but TSAN observes a stale read.
   
   ```java
   package forkjoinpooltsantest;
   
   import static com.google.common.truth.Truth.assertWithMessage;
   
   import java.util.concurrent.ForkJoinPool;
   import org.junit.Test;
   import org.junit.runner.RunWith;
   import org.junit.runners.JUnit4;
   
   @RunWith(JUnit4.class)
   public class ForkJoinPoolMemoryTest {
   
     private static final int STRESS_ITERATIONS = 100_000;
     private static final Object EXPECTED = new Object();
   
     /** Helper object containing plain (non-volatile) fields. */
     private static final class Holder {
       Object o;
     }
   
     @Test
     public void testCommonPoolSubmit_plainWriteIsAlwaysVisible() {
       for (int i = 0; i < STRESS_ITERATIONS; ++i) {
         final Holder holder = new Holder();
         holder.o = EXPECTED;
   
         // Submit a task to the common pool to read the value of the plain 
field, then join and
         // observe the returned value.
         Object observed = ForkJoinPool.commonPool().submit(() -> 
holder.o).join();
   
         assertWithMessage("Iteration %s: reference mismatch (possible stale 
read)", i)
             .that(observed)
             .isEqualTo(EXPECTED);
       }
     }
   }
   ```


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to