Tagged articles
34 articles
Page 1 of 1
macrozheng
macrozheng
Apr 12, 2026 · Backend Development

Why a Simple HashMap Bug Crashed Our High‑Concurrency Service and How to Fix It

A senior architect introduced a high‑concurrency monitoring feature that used ConcurrentHashMap, but missing equals/hashCode and non‑atomic updates caused massive memory leaks and race conditions, leading to a post‑mortem that highlights proper key implementation, atomic map operations, and cautious synchronization.

ConcurrentHashMapMemoryLeakconcurrency
0 likes · 7 min read
Why a Simple HashMap Bug Crashed Our High‑Concurrency Service and How to Fix It
macrozheng
macrozheng
Jan 30, 2026 · Backend Development

Why MyBatis Triggers OutOfMemoryError and How to Fix It

The article examines a production OutOfMemoryError caused by MyBatis SQL construction, explains heap and metaspace exhaustion, analyzes MyBatis source code, reproduces the issue with JVM settings, and offers practical recommendations to prevent similar memory failures.

BackendHeapMemoryLeak
0 likes · 7 min read
Why MyBatis Triggers OutOfMemoryError and How to Fix It
Cognitive Technology Team
Cognitive Technology Team
Sep 3, 2025 · Backend Development

Why Did My Java Service Hit 90% Memory? Uncovering Hidden NioChannel Leaks

An in‑depth investigation of a Java service’s memory alarm reveals that a surge of temporary NioChannel objects, caused by high QPS and insufficient socket reuse, prematurely promotes objects to the old generation, leading to uncollected memory growth, and the article details the diagnosis, GC tuning, and mitigation steps.

JVMMemoryLeakTomcat
0 likes · 29 min read
Why Did My Java Service Hit 90% Memory? Uncovering Hidden NioChannel Leaks
DaTaobao Tech
DaTaobao Tech
Dec 11, 2024 · Backend Development

Resolving Metaspace and Off‑Heap Memory Issues After JDK 11 Upgrade

After upgrading core services to JDK 11, the team encountered a Metaspace rise and off‑heap memory growth caused by class‑loading changes and Netty’s disabled native buffers, which were resolved by expanding Metaspace to 768 MB and adding JVM options to enable Netty reflection and open required modules, restoring normal memory usage.

JDK11JVMMemoryLeak
0 likes · 8 min read
Resolving Metaspace and Off‑Heap Memory Issues After JDK 11 Upgrade
Java Backend Technology
Java Backend Technology
Dec 5, 2024 · Backend Development

Why a Simple HashMap Bug Caused Massive Memory Leaks in High‑Concurrency Java Services

An overconfident architect introduced a high‑traffic monitoring feature using ConcurrentHashMap without proper equals/hashCode overrides, causing millions of duplicate keys, memory leaks, and crashes; the team debated synchronized versus putIfAbsent solutions, ultimately fixing the bug and highlighting essential concurrency and code‑review practices for Java back‑end development.

CodeReviewConcurrentHashMapMemoryLeak
0 likes · 7 min read
Why a Simple HashMap Bug Caused Massive Memory Leaks in High‑Concurrency Java Services
macrozheng
macrozheng
Nov 27, 2024 · Backend Development

How a Tiny HashMap Bug Triggered a Massive Memory Leak in a High‑Traffic Microservice

A senior architect introduced a high‑concurrency monitoring feature that used a ConcurrentHashMap without proper equals/hashCode implementations, leading to duplicate keys, race conditions, and severe memory leaks, which were later resolved by correcting the key class and applying atomic map operations.

ConcurrentHashMapMemoryLeakSynchronization
0 likes · 8 min read
How a Tiny HashMap Bug Triggered a Massive Memory Leak in a High‑Traffic Microservice
Huolala Tech
Huolala Tech
Jan 18, 2024 · Fundamentals

Why G1’s Humongous Objects Trigger Midnight Old‑Gen Spikes and How to Diagnose Them

This article walks through a real‑world G1 GC incident where massive humongous object allocations caused old‑generation memory spikes at night, explains the underlying JVM memory layout, shows how to trace the problem with heap dumps and monitoring data, and offers practical tips to avoid similar issues in Java applications.

HumongousObjectJVMMemoryLeak
0 likes · 41 min read
Why G1’s Humongous Objects Trigger Midnight Old‑Gen Spikes and How to Diagnose Them
DaTaobao Tech
DaTaobao Tech
Dec 8, 2023 · Backend Development

ZSTD Compression and GC Optimization in Java Netty Backend

Switching a Java Netty gateway from GZIP to ZSTD compression using zstd‑jni doubled GC time and introduced heap and Netty off‑heap memory leaks, which were resolved by employing the library’s direct off‑heap API with a NoFinalizer compressor, promptly releasing ByteBufs, avoiding finalize(), and adopting jemalloc to reduce fragmentation.

MemoryLeakNettygc
0 likes · 19 min read
ZSTD Compression and GC Optimization in Java Netty Backend
vivo Internet Technology
vivo Internet Technology
Oct 18, 2023 · Backend Development

Understanding JDK ThreadLocal and Netty FastThreadLocal: Implementation, Advantages, and Best Practices

The article compares JDK ThreadLocal and Netty FastThreadLocal, detailing their implementations, performance trade‑offs, and memory‑leak risks, illustrates a real‑world HTTPS bug caused by missing remove() calls, and recommends always cleaning up ThreadLocal values while noting FastThreadLocal’s O(1) access may not always outperform the JDK version.

FastThreadLocalMemoryLeakNetty
0 likes · 17 min read
Understanding JDK ThreadLocal and Netty FastThreadLocal: Implementation, Advantages, and Best Practices
JD Retail Technology
JD Retail Technology
Sep 14, 2023 · Backend Development

Root Cause Analysis of Memory Leak and High Latency in a Netty‑Based Real‑Time Risk Control System Using JDK 17 ZGC

This article investigates the severe memory growth and latency spikes observed when synchronizing data across data centers in a Netty‑driven online computation service, analyzes the impact of JDK 17 ZGC and direct‑buffer allocation, and presents the debugging steps, source‑code insights, and configuration changes that ultimately resolved the issue.

DirectMemoryMemoryLeakNetty
0 likes · 13 min read
Root Cause Analysis of Memory Leak and High Latency in a Netty‑Based Real‑Time Risk Control System Using JDK 17 ZGC
政采云技术
政采云技术
Aug 31, 2023 · Backend Development

Understanding Java ThreadLocal: Principles, Implementation, and Best Practices

ThreadLocal provides each Java thread with its own isolated variable copy, and this article explains its underlying mechanism, core methods (set, get, remove), internal ThreadLocalMap structure, practical code examples, common usage scenarios, and important considerations such as memory leaks and proper cleanup.

BackendMemoryLeakThreadLocal
0 likes · 12 min read
Understanding Java ThreadLocal: Principles, Implementation, and Best Practices
Selected Java Interview Questions
Selected Java Interview Questions
Jul 24, 2023 · Backend Development

Analyzing and Reproducing OutOfMemoryError Caused by MyBatis and DruidDataSource in a Java Backend Service

This article investigates the root causes of frequent OutOfMemoryError incidents in a distributed Java backend, explains how MyBatis and DruidDataSource can exhaust heap and metaspace, demonstrates a reproducible test with JVM options and multithreading, and offers practical mitigation strategies.

DockerMemoryLeakMyBatis
0 likes · 7 min read
Analyzing and Reproducing OutOfMemoryError Caused by MyBatis and DruidDataSource in a Java Backend Service
DaTaobao Tech
DaTaobao Tech
Jun 28, 2023 · Backend Development

Debugging V8FatalErrorCallback OOM Crashes in Electron Live Streaming Client

The article details how the author traced V8FatalErrorCallback out‑of‑memory crashes in an Electron‑based Taobao Live client to an ever‑growing compilation cache and pointer‑compression limits, rebuilt Electron with those disabled, identified a JavaScript memory leak caused by unfiltered error logging, and implemented runtime heap monitoring to prevent future OOM failures.

ChromeDevToolsElectronMemoryLeak
0 likes · 35 min read
Debugging V8FatalErrorCallback OOM Crashes in Electron Live Streaming Client
Cognitive Technology Team
Cognitive Technology Team
Oct 15, 2022 · Fundamentals

Analysis of Java ThreadLocal Implementation and Usage Pitfalls

This article explains the internal workings of Java's ThreadLocal, including the ThreadLocalMap structure, weak reference handling, lazy initialization, and common pitfalls such as memory leaks in thread pools, and provides best‑practice guidelines for safe usage.

BestPracticesMemoryLeakThreadLocal
0 likes · 7 min read
Analysis of Java ThreadLocal Implementation and Usage Pitfalls
Cognitive Technology Team
Cognitive Technology Team
Jul 9, 2022 · Backend Development

Avoiding OOM When Using java.util.concurrent.ExecutorCompletionService

The article explains how submitting tasks to ExecutorCompletionService without retrieving their results causes the internal unbounded LinkedBlockingQueue to retain Future objects, leading to memory leaks and OutOfMemoryError, and demonstrates the correct usage patterns to prevent this issue.

ExecutorCompletionServiceMemoryLeakOOM
0 likes · 6 min read
Avoiding OOM When Using java.util.concurrent.ExecutorCompletionService
Su San Talks Tech
Su San Talks Tech
May 14, 2022 · Backend Development

Unlocking ThreadLocal: How Java Manages Thread‑Local Data and Avoids Memory Leaks

This article explains why ThreadLocal is used in Java concurrency, dives into its internal implementation—including ThreadLocalMap, weak‑referenced keys, hash‑based indexing and resizing—covers common pitfalls such as memory leaks, and shows how InheritableThreadLocal and TransmittableThreadLocal can safely share data across child threads and thread pools.

InheritableThreadLocalMemoryLeakThreadLocal
0 likes · 24 min read
Unlocking ThreadLocal: How Java Manages Thread‑Local Data and Avoids Memory Leaks
Top Architect
Top Architect
May 10, 2022 · Mobile Development

Comprehensive Guide to OOM Issues, Thread Optimization, and Memory Leak Monitoring in Android Apps

This article explains the root causes of Out‑Of‑Memory (OOM) crashes on Android, classifies OOM types, and provides practical, non‑intrusive solutions for thread‑count, file‑descriptor, and heap‑memory problems, along with monitoring techniques using thread pools, image compression, LeakCanary, KOOM and native hooks.

AndroidMemoryLeakMobileDev
0 likes · 23 min read
Comprehensive Guide to OOM Issues, Thread Optimization, and Memory Leak Monitoring in Android Apps
Cognitive Technology Team
Cognitive Technology Team
Apr 24, 2022 · Backend Development

Pitfalls of Using ThreadLocal for User Context in Java Applications

Using ThreadLocal to store user information in Java web applications can lead to hidden failures such as loss of context and memory leaks, especially when thread pools are involved, so developers should restrict its usage to controller threads and employ static analysis tools to detect improper usage.

MemoryLeakThreadLocalThreadPool
0 likes · 4 min read
Pitfalls of Using ThreadLocal for User Context in Java Applications
Sohu Tech Products
Sohu Tech Products
Aug 5, 2020 · Backend Development

Debugging and Fixing the ConcurrentLinkedQueue Memory Leak Bug in JDK8

This article explains the root cause of a memory‑leak bug in JDK8's ConcurrentLinkedQueue, demonstrates how to reproduce and visualize the issue with custom CLQ implementations, analyzes the removal algorithm, and shares practical debugging tips including a notorious IDEA debug pitfall and its resolution.

ConcurrentLinkedQueueJDK8MemoryLeak
0 likes · 14 min read
Debugging and Fixing the ConcurrentLinkedQueue Memory Leak Bug in JDK8
Programmer DD
Programmer DD
Dec 15, 2019 · Backend Development

Java ThreadLocal Deep Dive: Structure, 0x61c88647 Hash Trick & Usage

This article explains the internal architecture of Java's ThreadLocal, including its ThreadLocalMap implementation, the purpose of the special hash code 0x61c88647, collision handling strategies, proper usage patterns in web applications, and precautions for avoiding memory leaks in thread pools.

HashingMemoryLeakThreadLocal
0 likes · 12 min read
Java ThreadLocal Deep Dive: Structure, 0x61c88647 Hash Trick & Usage
Meituan Technology Team
Meituan Technology Team
Aug 19, 2016 · Mobile Development

Understanding Memory Leaks with RACObserve and RACSubject in ReactiveCocoa

In ReactiveCocoa, using RACObserve inside a flattenMap or applying map to a hot RACSubject can create retain cycles because the generated blocks capture self and the subject retains its subscribers, so employing @weakify/@strongify and ensuring signals send a completed or error event breaks these hidden memory leaks.

MemoryLeakObjective‑CReactiveCocoa
0 likes · 15 min read
Understanding Memory Leaks with RACObserve and RACSubject in ReactiveCocoa