finds.dev← search

// the find

oldratlee/fucking-java-concurrency

★ 1,214 · Java · Apache-2.0 · updated Jun 2026

🎏 Simple showcases of java concurrency problems, seeing 🙈 is believing 🐵

A collection of runnable Java programs that demonstrate classic concurrency bugs — visibility failures, deadlocks, livelocks, torn reads on long variables, and more. Each demo is a self-contained main class you can run and watch break. Aimed at developers who learn better from watching a program hang or produce garbage than from reading a textbook.

Each bug is isolated to a single file with a clear problem statement, so you can read the code, predict what should happen, and then run it to see what actually happens — that feedback loop is more effective than most concurrency tutorials. The HashMap infinite loop and torn long-variable demos cover bugs that are genuinely subtle and not obvious from reading the JLS. The cyclic thread pool deadlock example with the CompletableFuture fix is a useful addition — it shows the bad pattern and the corrected one side by side. CI is running on current Java via GitHub Actions, so the demos actually compile and behave as advertised.

There is no explanation of why any of these bugs happen — the README explicitly says it skips theory and tells you to look elsewhere. That is a real gap: seeing the symptom without understanding the memory model leaves a developer just as likely to repeat the mistake. The demo set is mostly pre-Java-5 era bugs; nothing here covers virtual threads, structured concurrency, or modern pitfalls with CompletableFuture chains beyond the one example. Some of the problems (like torn long reads) are only reproducible on specific JVMs or hardware and may silently pass on a developer's machine, which undermines the 'seeing is believing' premise. No tests — you have to eyeball output to verify the bug triggered, which makes this fragile as a teaching tool.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →