xjtushilei opened a new issue, #12419:
URL: https://github.com/apache/lucene/issues/12419
### Description
I use lucene 9.6 in multi-threading, and then found that if the three
classes `IndexWriter`, `SegmentReader`, and `ConcurrentMergeScheduler` are used
in a multi-threaded environment, the thread will be stuck.
The reason is that the `TestSecrets.java` class caused static initialization
deadlock.
This bug has a great impact on me, I hope it can be fixed as soon as
possible.
The following code can be reproduced stably.
```
import org.apache.lucene.index.ConcurrentMergeScheduler;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.store.ByteBuffersDirectory;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
public class Test {
public static void main(String[] args) throws InterruptedException {
CountDownLatch startLatch = new CountDownLatch(1);
Thread t1 = new Thread(() -> {
try {
startLatch.await();
new IndexWriter(new ByteBuffersDirectory(), new
IndexWriterConfig());
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
});
Thread t2 = new Thread(() -> {
try {
startLatch.await();
new ConcurrentMergeScheduler();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
});
t1.start();
t2.start();
System.out.println("Start!");
startLatch.countDown();
t2.join();
t1.join();
System.out.println("Done");
}
}
```
### Version and environment details
- Lucene version: 9.6
- Java version: 11, and the java version in my MacBookPro is "11.0.16.1"
2022-08-18 LTS
- OS
- mac os 11.6.1
- centos 7.x
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]