Discovering a JDK Race Condition, and Debugging It in 30 Minutes with Fray
a year ago
- #Concurrency
- #Debugging
- #JDK
- A deadlock exception was discovered in the JDK while testing with Fray.
- The issue occurs in ScheduledThreadPoolExecutor when scheduling a task and shutting down the executor in another thread.
- Fray's deterministic replay and schedule visualization helped identify the race condition in the JDK.
- The bug causes FutureTask.get to block indefinitely when the executor is in the SHUTDOWN state.
- The race condition bypasses checks in ThreadPoolExecutor, leaving tasks in a limbo state.
- Fray allows replaying the bug step-by-step, making it easier to understand and debug.
- Instructions provided to reproduce the bug using Fray and IntelliJ IDEA.
- A patch was created for the JDK, but the public bug report only included Fray-based reproduction steps.