Discovering a JDK Race Condition, and Debugging it in 30 Minutes with Fray
I’ve been adding more integration tests for Fray recently. To ensure Fray can handle different scenarios, I wrote many creative test cases. Many of them passed as expected, while some failures led to epic fixes in Fray. Then something unexpected happened: Fray threw a deadlock exception while testing the following seemingly innocent code:
1private void test() {
2 ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
3 // Shutdown thread.
4 new Thread(() -> {
5 ...
Read more at aoli.al