Java's CharsetDecoder Is Not Thread-Safe
Java's CharsetDecoder is not thread-safe. When a singleton instance is shared across threads, concurrent decode() calls corrupt each other's output. This post walks through the race condition, demonstrates it under load, and shows how to fix it.