Program: 52104
Project: 52104
Buggy source:
@Test public void concurrentLockItUp() throws InterruptedException {
  final AtomicInteger written=new AtomicInteger();
  final AtomicReference<String> writerQueueFile=new AtomicReference<>();
  final File path=DirectoryUtils.tempDir(this.getClass().getSimpleName());
  final SingleChronicleQueueBuilder builder=ChronicleQueueBuilder.single(path).sourceId(1).rollCycle(ROLL_CYCLE).timeoutMS(TIMEOUT_MS);
  final String initialFile;
  final DocumentContext initialContext=builder.build().acquireAppender().writingDocument();
  initialContext.wire().write("String_Node_Str");
  initialFile=getFilename(initialContext);
  final long afterInitialWrite=System.currentTimeMillis();
  final CountDownLatch writerStarted=new CountDownLatch(1);
  Thread writerThread=new Thread(() -> {
    ExcerptAppender appender=builder.build().acquireAppender();
    writerStarted.countDown();
    try (@NotNull DocumentContext context=appender.writingDocument()){
      written.incrementAndGet();
      writerQueueFile.set(getFilename(context));
      Wire wire=context.wire();
      wire.write("String_Node_Str");
      wire.padToCacheAlign();
    }
   }
);
  writerThread.start();
  assertTrue("String_Node_Str",writerStarted.await(1,TimeUnit.SECONDS));
  while (System.currentTimeMillis() < afterInitialWrite + (TIMEOUT_MS - 50)) {
    Thread.sleep(10);
  }
  final long elapsedMillis=System.currentTimeMillis() - afterInitialWrite;
  assertTrue("String_Node_Str",elapsedMillis < TIMEOUT_MS);
  assumeTrue("String_Node_Str",writerQueueFile.get() == null || initialFile.equals(writerQueueFile.get()));
  assertEquals("String_Node_Str",0,written.get());
  long start=System.currentTimeMillis();
  while (System.currentTimeMillis() < start + TIMEOUT_MS) {
    if (written.get() > 0)     break;
  }
  assertTrue("String_Node_Str",written.get() > 0);
}

Fixed version (ground truth):
@Test public void concurrentLockItUp() throws InterruptedException {
  final AtomicInteger written=new AtomicInteger();
  final AtomicReference<String> writerQueueFile=new AtomicReference<>();
  final File path=DirectoryUtils.tempDir(this.getClass().getSimpleName());
  final SingleChronicleQueueBuilder builder=ChronicleQueueBuilder.single(path).sourceId(1).rollCycle(ROLL_CYCLE).timeoutMS(TIMEOUT_MS);
  final String initialFile;
  final DocumentContext initialContext=builder.build().acquireAppender().writingDocument();
  initialContext.wire().write("String_Node_Str");
  initialFile=getFilename(initialContext);
  final long afterInitialWrite=System.currentTimeMillis();
  final CountDownLatch writerStarted=new CountDownLatch(1);
  Thread writerThread=new Thread(() -> {
    ExcerptAppender appender=builder.build().acquireAppender();
    writerStarted.countDown();
    try (@NotNull DocumentContext context=appender.writingDocument()){
      written.incrementAndGet();
      writerQueueFile.set(getFilename(context));
      Wire wire=context.wire();
      wire.write("String_Node_Str");
      wire.padToCacheAlign();
    }
   }
);
  writerThread.start();
  assertTrue("String_Node_Str",writerStarted.await(1,TimeUnit.SECONDS));
  while (System.currentTimeMillis() < afterInitialWrite + (TIMEOUT_MS - 50)) {
    Thread.sleep(10);
  }
  final long elapsedMillis=System.currentTimeMillis() - afterInitialWrite;
  assertTrue("String_Node_Str",elapsedMillis < TIMEOUT_MS);
  assumeTrue("String_Node_Str",writerQueueFile.get() == null || initialFile.equals(writerQueueFile.get()));
  int actual=System.currentTimeMillis() < start0 + (timeoutMS - 50) ? 0 : written.get();
  assertEquals("String_Node_Str",0,actual);
  long start=System.currentTimeMillis();
  while (System.currentTimeMillis() < start + TIMEOUT_MS) {
    if (written.get() > 0)     break;
  }
  assertTrue("String_Node_Str",written.get() > 0);
}