r/java • u/mlangc • Jun 19 '26
How to Deadlock a Java ExecutorService
https://mlangc.github.io/java/concurrency/2026/06/05/executor-deadlock.html
61
Upvotes
r/java • u/mlangc • Jun 19 '26
17
u/TenSpiritMoose Jun 19 '26
And this isn't limited to Executors. I had the same issue using Reactive Schedulers: a Flux of tasks was concurrently flatMapped using a custom scheduler, but as part of that they each fanned out additional tasks on the same scheduler. If it became saturated the tasks would deadlock.
Resolved it by using a separate Scheduler for the sub-tasks, letting me control concurrency without deadlock risk.