Skip to main content

Posts

Showing posts with the label RCA

πŸ’¬ JVM Crash Deep Dive | Heap Dumps, RCA, and Developer Curiosity

  ☕ Have you ever had a Java application just... vanish ? No stack trace. No clear error. Just a core dump or a mysterious hs_err_pid file left behind like a clue from a crime scene. Over the past few weeks, I’ve been wrestling with this. 🧠 I kept asking myself: What really causes a JVM crash ? Is it always the app’s fault? How can I truly diagnose and prevent it? And how do I make sense of that gigantic heap dump file? So I went deep into the internals. Here’s what I found πŸ‘‡ πŸ” Why JVM Crashes (Beyond Just “OOM”) Yes, we all know about OutOfMemoryErrors. But JVM crashes often involve subtle, deeper issues: 🧬 Native Code Issues – JNI calls from Java to C/C++ can corrupt memory if not handled properly πŸ•Έ️ Threading Chaos – Deadlocks, race conditions, or blocked critical threads can destabilize the runtime πŸ—‚️ DirectByteBuffer Abuse – Memory allocated outside the heap can escape GC tracking 🧱 Corrupt JVM Installation – Misconfigured JDKs, mixed versions, or...

πŸ” "Billing Gone Wrong: How Lack of Synchronization Led to Swapped Bills (And What I Learned!)"

☕ A Walk Down Memory Lane: My First Bug Nightmare About 9 years ago, as a fresher, I worked on a billing system for a retail application. The system was accessed both from mobile and web UI , and the actual billing logic was written in stored procedures (SQL-based backend). Everything looked fine... until customers started reporting weird issues : πŸ› The Bug: Bills Were Swapping Items! 😱 🧾 Scenario: Two different users generated separate bills around the same time One from Mobile , the other from Web The output bills had mixed-up items — each invoice had products that belonged to the other one! 🧨 πŸ” Initial Questions: "Is this a DB issue?" "Are stored procedures broken?" "Race condition in app layer?" Turns out... 🚫 The code calling stored procedures wasn’t thread-safe. There was no synchronized mechanism to ensure each bill transaction was isolated. 🧠 The Root Cause Analysis (RCA): We were calling a shared BillingService.calculat...

πŸ” “MongoDB OIDC with Spring Boot: Driver Drama & Terraform Troubles (And How I Solved Them)”

  🧩 Introduction Setting up MongoDB with OIDC authentication in a production-grade Spring Boot app sounds simple — until reality strikes. πŸ˜… This post covers two specific issues I faced when integrating MongoDB v8 with Spring Boot 3.3.6 , and deploying the app via Terraform to Cloud Run . If you’re planning the same, ame, save yourself some debugging time and read on. πŸ‘‡ πŸ› Issue #1: MongoDB Driver Compatibility – “Unsupported authMechanism: MONGODB-OIDC” πŸ”₯ The Problem: After upgrading to MongoDB v8 , my app started throwing this error: Unsupported authMechanism: MONGODB-OIDC Turns out, the default MongoDB driver version (5.0.1) pulled in by Spring Boot 3.3.6 isn’t compatible with MongoDB v8, especially when using OIDC authentication . Turns out, the default MongoDB driver version (5.0.1) pulled in by Spring Boot 3.3.6 isn’t compatible with MongoDB v8, especially when using OIDC authentication . ✅ The Fix: Manually specify compatible driver versions ( 5.2.1 or abo...