Tagged articles
4 articles
Page 1 of 1
Cognitive Technology Team
Cognitive Technology Team
Jun 10, 2024 · Backend Development

Recursive Update Bug in ConcurrentHashMap.computeIfAbsent Causing Infinite Loop and CPU Spike

The article explains a bug in Java's ConcurrentHashMap.computeIfAbsent that can cause recursive updates and infinite loops, leading to CPU spikes, and shows that newer Java versions throw an IllegalStateException while recommending avoiding nested computeIfAbsent/putIfAbsent calls, with a code example.

BackendConcurrentHashMapJava
0 likes · 3 min read
Recursive Update Bug in ConcurrentHashMap.computeIfAbsent Causing Infinite Loop and CPU Spike
Code Ape Tech Column
Code Ape Tech Column
Dec 27, 2020 · Backend Development

Why ThreadLocal and ConcurrentHashMap Can Still Cause Bugs—and How to Fix Them

This article examines common misconceptions about Java concurrency utilities such as ThreadLocal, ConcurrentHashMap, and CopyOnWriteArrayList, demonstrates real‑world bugs caused by thread reuse and non‑atomic operations, and provides concrete solutions and performance‑tested alternatives.

ConcurrentHashMapCopyOnWriteArrayListJava concurrency
0 likes · 12 min read
Why ThreadLocal and ConcurrentHashMap Can Still Cause Bugs—and How to Fix Them
macrozheng
macrozheng
Aug 13, 2020 · Backend Development

Why JDK 8’s computeIfAbsent Can Deadlock: A Deep Dive into the Bug

This article explores a JDK 8 bug in ConcurrentHashMap’s computeIfAbsent method that can cause an infinite loop, explains how the issue was discovered, reproduces it with test code, analyzes the root cause, and shows the fix introduced in JDK 9.

ConcurrentHashMapJDKbug
0 likes · 16 min read
Why JDK 8’s computeIfAbsent Can Deadlock: A Deep Dive into the Bug