{"id":9614,"date":"2026-07-31T17:44:06","date_gmt":"2026-07-31T17:44:06","guid":{"rendered":"https:\/\/blog.shahada.abubakar.net\/?p=9614"},"modified":"2026-07-31T17:44:18","modified_gmt":"2026-07-31T17:44:18","slug":"the-great-exception","status":"publish","type":"post","link":"https:\/\/blog.shahada.abubakar.net\/?p=9614","title":{"rendered":"The Great Exception"},"content":{"rendered":"\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"559\" data-id=\"9616\" src=\"https:\/\/blog.shahada.abubakar.net\/wp-content\/uploads\/2026\/07\/1000077521-1-1024x559.png\" alt=\"\" class=\"wp-image-9616\" srcset=\"https:\/\/blog.shahada.abubakar.net\/wp-content\/uploads\/2026\/07\/1000077521-1-1024x559.png 1024w, https:\/\/blog.shahada.abubakar.net\/wp-content\/uploads\/2026\/07\/1000077521-1-300x164.png 300w, https:\/\/blog.shahada.abubakar.net\/wp-content\/uploads\/2026\/07\/1000077521-1-768x419.png 768w, https:\/\/blog.shahada.abubakar.net\/wp-content\/uploads\/2026\/07\/1000077521-1.png 1408w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I just fed claude my logs and source code for an ancient project that was causing problems &#8230; daily notification emails not going out on some days.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wasn&#8217;t getting far with Sonnet, so I upped to Opus and set effort to max.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I burnt 95% of my&nbsp; 5 hours of usage in 30 minutes. We went through hoops, pouring through source code, analyzing log files, probing the database in all kinds of places. But managed to trace down the problem. One of those where the cause is very far from the effect.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To entertain myself, I used up the last 5% of credit with the following prompt:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8220;Now document the steps you took to identify the bug, how you identified sources, gathered evidence. Include your thought processes, how you pinpointed the cause, and confirmed the issue. Mention all the missteps and misdirections. Include also what you did to mitigate the problem in the future.&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">(here&#8217;s the kicker&#8230;)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8220;<strong>Write it in the style of a noir-fiction detective, running a case. Keep the suspense up. Make it a riveting read.<\/strong>&#8220;<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">The Great Exception<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\"><em>A case file from the graveyard shift.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">I. The Client Walks In<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">It was the last day of July when the log file slid across my desk, still warm from the <code>journalctl<\/code> pipe.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The complaint was simple, the way the bad ones always are. Every morning at eight, a process called <strong>HouseKeeping<\/strong> was supposed to send out one email \u2014 the <em>Notification Summary Blast<\/em>. A roll call of everything wrong in the field. Rain gauges gone dark. Sensors past due. The daily bad news, wrapped in an HTML table and mailed to the men who cared.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Most mornings it went out. Some mornings it didn&#8217;t. Nobody could say why.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Jul 27 08:00:02  Blasting Notification Summary Email\nJul 29 08:00:01  Blasting Notification Summary Email\nJul 30 08:00:01  Blasting Notification Summary Email<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Count the days. Twenty-seven. Twenty-nine. Thirty. Somewhere in there, the <strong>twenty-eighth<\/strong> never showed. A blast that should have fired and didn&#8217;t, and no scream, no stack trace, no note left on the pillow. Just a gap where a heartbeat should be.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They told me the server got restarted a few times. They told me it like it explained something.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It didn&#8217;t explain a thing. But I took the case anyway. I always do.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">II. The Wrong Man<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First theory came easy, and the easy ones are usually the first to lie to you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I found the scheduler in <a href=\"src\/my\/com\/nextsense\/j0052_jps_rhn\/server\/app\/houseKeeping\/HouseKeeping.java\">HouseKeeping.java<\/a> \u2014 a little clerk who wrote tomorrow&#8217;s appointment in the margin of today&#8217;s:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nextBlast = today 8AM;\nif (! nextBlast.isAfter(now)) nextBlast = nextBlast.plusDays(1);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">All in memory. No ledger. No persistence. Kill the process and the clerk forgets every appointment he ever made. So here&#8217;s the frame I built: the server goes down before eight, comes back up <em>after<\/em> eight, and the clerk shrugs \u2014 <em>8 AM? That&#8217;s passed, friend. See you tomorrow.<\/em> The twenty-eighth gets skipped. Clean. Motive, means, opportunity.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I liked that theory. I liked it right up until the client leaned across the desk and put a cigarette out on it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>&#8220;The lack of a &#8216;First BlastNotificationSummaryEmail&#8217; line,&#8221;<\/em> he said, <em>&#8220;means the server didn&#8217;t restart after the twenty-eighth.&#8221;<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">He was right, and I hated that he was right. Every cold start leaves fingerprints \u2014 a line that reads <code>First BlastNotificationSummaryEmail scheduled for\u2026<\/code>. I went back through the logs looking for it in the gap. There wasn&#8217;t one. No restart. No cold start. The process that owed us the twenty-eighth had been alive the whole time and simply hadn&#8217;t paid up.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My prime suspect had an alibi. The building was never empty. Somebody was home, and they still let the blast die.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Back to zero. The city outside kept raining.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">III. A Ghost in the Machine<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s the thing they don&#8217;t teach you about a JVM: the building can have all its lights on and still be full of dead men.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>HouseKeeping<\/strong> wasn&#8217;t the whole process. It was one <em>thread<\/em> \u2014 a single night watchman walking a single beat, once a second, forever. Station-down checks. Auto-close. Session sweeps. File cleanup. The password mailer. And the eight o&#8217;clock blast. One man. One flashlight. One key ring for the whole building \u2014 a lone database connection he grabbed at the start of his shift and never set down.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A watchman like that doesn&#8217;t need the building to burn down to stop making his rounds. He just needs to <em>stop<\/em>. And there are only three ways a man stops:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>He gets <strong>stuck<\/strong> \u2014 frozen at a door that won&#8217;t open.<\/li>\n\n\n\n<li>He gets <strong>killed<\/strong> \u2014 and the body&#8217;s carried out so quiet nobody hears.<\/li>\n\n\n\n<li>Somebody hands him a pink slip \u2014 the clean shutdown. But we&#8217;d have seen that in the logs, and we didn&#8217;t.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I went looking for the door that wouldn&#8217;t open. Found a good candidate fast. The mail room \u2014 <a href=\"src\/my\/com\/nextsense\/j0052_jps_rhn\/server\/utils\/Emailer.java\">Emailer.java<\/a> \u2014 sends its letters and <em>never sets a timeout<\/em>. No <code>mail.smtp.connectiontimeout<\/code>. No read timeout. Nothing. If the post office across town stops answering, our watchman stands at the counter until the heat death of the universe.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That felt like a killer. A silent SMTP hang, the whole beat frozen behind one unanswered letter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I wrote it down in my notebook and underlined it twice.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I was wrong about that too. But it would take a second body to show me how.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">IV. The Second Body<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><em>&#8220;Yet we have no entry on the thirty-first.&#8221;<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The client again, quiet as a dropped shell casing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I checked. He was right \u2014 <em>again<\/em>. And this one changed everything. Because the process that owed us the thirty-first wasn&#8217;t some ghost from the twenty-eighth. It was <strong>2512248<\/strong> \u2014 a fresh face, booted the evening of the twenty-eighth, and I could watch him work. He blasted clean on the twenty-ninth. Blasted clean on the thirtieth. Rescheduled himself, polite as you please, for the thirty-first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then nothing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Same man. No restart. Worked two mornings, missed the third. You don&#8217;t get that pattern from a bad schedule or a one-night outage. You get that pattern from a man who&#8217;s still standing at his post \u2014 and cold to the touch.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The mail-room-hang theory started to smell. So did every theory that needed the thirty-first to be an <em>accident<\/em>. Two bodies, same building, same beat, no forced entry. That&#8217;s not bad luck.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s a pattern. And a pattern means somebody&#8217;s <em>doing<\/em> this.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">V. The Log Doesn&#8217;t Lie (But It Doesn&#8217;t Volunteer)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The client handed me the break without knowing it. Pointed a finger at one line and said the truest thing anyone said the whole case:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>&#8220;We&#8217;re looking for &#8216;Blasting Notification Summary Email.&#8217; Whether it sent the email or not doesn&#8217;t matter.&#8221;<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;d been chasing the mail room. But look at where that line gets written \u2014 <a href=\"src\/my\/com\/nextsense\/j0052_jps_rhn\/server\/app\/houseKeeping\/HouseKeeping.java#L359\">line 362\u2026 no, 359<\/a>, the <em>first<\/em> thing the blast does, before it touches an envelope:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>logger.info(\"Blasting Notification Summary Email\");   \/\/ spoken the instant he walks in\nservice.send();                                        \/\/ the letters come after<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The watchman <em>announces himself<\/em> the moment he enters the mail room. So it never mattered whether the mail hung or the mail failed. If we don&#8217;t see <code>Blasting\u2026<\/code>, <strong>he never reached the door at all.<\/strong> The SMTP hang, the mail room, my double-underlined suspect \u2014 a red herring, gutted and left on the dock. Whatever stopped him, stopped him <em>upstream<\/em>. Before eight. Before the letters.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And there was something else in the logs, something I should have smelled sooner. The blast, on the mornings it <em>did<\/em> fire, was getting <strong>slower<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Jul 25   1.6 s\nJul 29   3.8 s\nJul 30  11.3 s   \u2190 eleven seconds. something's swelling.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A job doesn&#8217;t put on weight like that for no reason. Something was growing in the dark. I didn&#8217;t know what yet. But the body was getting heavier every night.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">VI. The Heartbeat<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every man has a tell. Our watchman&#8217;s was a small one \u2014 the session sweep, <code>clearUserSessions<\/code>, which he ran <strong>every sixty seconds<\/strong> and logged every single time:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>next ClearSessionsCheck scheduled for \u2026<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sixty-second footsteps. A pulse. Find the last one before a body drops and you&#8217;ve got time of death to the minute.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I asked for it. The client pulled the tape.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Jul 30 07:59:47   next ClearSessionsCheck scheduled for 08:00:46<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And then \u2014 silence. The 08:00:46 step never landed. The pulse flatlined at <strong>07:59:47<\/strong>, seconds before eight, on the morning of the thirtieth. Two days dead and nobody had checked the body.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now I had a window. He was alive at 07:59:47. The blast fired at 08:00:01, took its eleven swollen seconds, logged <code>next scheduled for the thirty-first<\/code> at 08:00:12 \u2014 and then the footsteps never came back. So the kill happened in that gap. And I, being the kind of detective who&#8217;s sure right up until he&#8217;s wrong, looked at what ran in that gap and pointed at the file-cleanup job \u2014 <code>removeReceivedDataFiles<\/code>, a <code>DELETE<\/code> on the shared key ring, maybe jammed on a database lock.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I even drew up the whole board. <em>Lock, or dead socket, or something worse.<\/em> Told the client to dust the thread for prints \u2014 <code>kill -3<\/code> for a thread dump, <code>pg_stat_activity<\/code> for a jammed query.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I was circling the truth and still had the wrong man in the chair. The gap was right. The <em>cause<\/em> in the gap was a guess, and the guess was wrong.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The evidence came back and put the whole thing to bed.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">VII. The Confession<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The thread dump came up empty \u2014 no <strong>HouseKeeping<\/strong> thread anywhere in the building. Not stuck. <em>Gone.<\/em> The database showed no jammed query, no lock, nobody waiting. My file-cleanup suspect had never even entered the room.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And then the client pasted the eight lines that had been sitting in the log the whole time, waiting for someone to read them in order:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>08:00:01  Blasting Notification Summary Email\n08:00:06  Sending \"\u2026Compilation at 08:00 2026-07-30\" to afif@water.gov.my\n08:00:12  next BlastNotificationSummaryEmail scheduled for 2026-07-31T08:00\n08:00:12  Exception in thread \"HouseKeeping\" java.lang.OutOfMemoryError: Java heap space\n          at \u2026blastNotificationSummaryEmail(HouseKeeping.java:362)\n          at \u2026run(HouseKeeping.java:169)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">There it was. The murder weapon, still in the hand. <strong>Java heap space.<\/strong> Not a lock. Not a socket. Not the mail room. The watchman walked into the blast carrying too much, and the building ran out of floor to hold it. He died at <a href=\"src\/my\/com\/nextsense\/j0052_jps_rhn\/server\/app\/houseKeeping\/HouseKeeping.java#L362\">HouseKeeping.java:362<\/a>, mid-sentence, with the letters half-written.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But the <em>cruelest<\/em> detail \u2014 the reason this case stayed cold so long \u2014 was the witness. The <code>finally<\/code> block. Look at the timestamps: <strong>08:00:12<\/strong>, the log swears the watchman calmly <em>scheduled tomorrow&#8217;s blast<\/em> \u2014 and <strong>08:00:12<\/strong>, the same second, he&#8217;s dead on the floor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because a <code>finally<\/code> runs even while the body is falling. And the net that was <em>supposed<\/em> to catch trouble \u2014<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>} catch (Exception e) {   \/\/ catches thieves. does NOT catch the thing that kills you.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u2014 only catches <code>Exception<\/code>. An <code>OutOfMemoryError<\/code> isn&#8217;t an <code>Exception<\/code>. It&#8217;s an <code>Error<\/code>. It walked straight through the net, let the <code>finally<\/code> scribble its cheerful little lie about tomorrow, and then carried the watchman out the back door without a sound. No shutdown log. No scream. Just a thread that stepped out for the eight o&#8217;clock mail and never came back \u2014 while the rest of the building kept the lights on, kept serving the public, kept <em>pretending everything was fine<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Visitor stats for the thirty-first: 103. The city never even noticed the watchman was dead.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I had my murder. Now I needed to know what he&#8217;d been carrying that was heavy enough to kill a man.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">VIII. Follow the Weight<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You want to understand a killing, you weigh the body. One query:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT status, count(*) FROM notifications GROUP BY status;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code> O  | 431306        C  | 13161\n I  | 431166        N  |     4<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Eight hundred and seventy-five thousand notifications. And the ones the blast had to haul into memory every morning \u2014 the <em>open<\/em> ones, everything not <code>Completed<\/code> and not <code>AutoClosed<\/code> \u2014 came to <strong>431,170 rows<\/strong>. Nearly half a million lines, rendered into one HTML table, every single morning. No wonder the body got heavier every night. No wonder it finally crushed him.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now \u2014 I&#8217;d love to tell you I walked straight to the source. I didn&#8217;t. I looked at those 431,166 <code>InAction<\/code> rows that should&#8217;ve been auto-closed days ago and I floated a theory: <em>maybe their timestamps are NULL, so the auto-closer can&#8217;t see them.<\/em> Elegant. Tidy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wrong. The query came back and slapped it down \u2014 not a NULL among them, and 367,812 of them were plenty old enough to close. They hadn&#8217;t closed for the dumbest reason in the world: <strong>the auto-closer was the same dead watchman.<\/strong> No pulse, no rounds, no auto-close. The bodies were just piling up because the man who buried them was in the morgue himself.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But the <em>second<\/em> query \u2014 that&#8217;s the one that cracked the case open:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT notification_type_dict_key, count(*), min(start)::date, max(start)::date\nFROM notifications WHERE status IN ('I','N') GROUP BY 1 ORDER BY 2 DESC;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>CALIBRATIONDUE.Rainfall.1  | 280620 | 2026-07-28 | 2026-07-30\nCALIBRATIONDUE.Rainfall.2  | 112248 | 2026-07-28 | 2026-07-30\nCALIBRATIONDUE.Evaporation |  37416 | 2026-07-28 | 2026-07-30\nSTATIONDOWN                |    797  ...<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ninety-nine percent of the weight was <strong>calibration-due<\/strong> notices. Four hundred and thirty thousand of them. And every last one born in a <strong>three-day window.<\/strong> Something in this building had spent seventy-two hours screaming the same warning over and over until it buried a man alive.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I had the <em>what<\/em>. I needed the <em>who<\/em>. And that&#8217;s when a second detective walked into my office with a theory of his own.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">IX. The Frame<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The client had a hunch, and it was a reasonable one \u2014 the kind that gets an innocent man hanged.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>&#8220;A lot of sensors are overdue,&#8221;<\/em> he said. <em>&#8220;The field crews aren&#8217;t calibrating them, or aren&#8217;t updating the system. Find me the evidence, and let&#8217;s just rip calibration out of the notifications.&#8221;<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Blame the client&#8217;s own field crews. Blame the neglected hardware in a thousand rain gauges. It fit the smell of the place. And it would&#8217;ve been so <em>easy<\/em> to nod, pull the calibration code, and call it a night.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But you don&#8217;t hang a man on a hunch. You check the <em>source<\/em>. Not the notifications \u2014 those are just the echoes. The truth lived in the <code>stations<\/code> table, in the calibration due-dates themselves. So I counted the actual overdue sensors:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT (SELECT count(*) FROM stations) AS total_stations,\n       count(*) FILTER (WHERE rainfall_1_calibration_due_date &lt;= current_date - 14) AS rf1_overdue,\n       ...<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code> total_stations | rf1_overdue | rf2_overdue | evap_overdue\n----------------+-------------+-------------+--------------\n       949      |     15      |      6      |      2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Nine hundred and forty-nine stations in the whole network. And genuinely overdue for calibration? <strong>Fifteen. Six. Two.<\/strong> Across every sensor type on every station in the field \u2014 <strong>twenty-three sensors, total.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Twenty-three. And they&#8217;d spawned four hundred and thirty <em>thousand<\/em> notices.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The field crews weren&#8217;t the villains. They never were. Somebody was taking twenty-three honest little warnings and <em>forging them a quarter-million times<\/em>. I put the counts side by side and the forgery signature jumped off the page:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Rainfall.1 :  41,295 notices  \/  15 real stations  =  2,753\u00d7\nRainfall.2 :  16,518 notices  \/   6 real stations  =  2,753\u00d7\nEvaporation:   5,506 notices  \/   2 real stations  =  2,753\u00d7<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The same multiplier. <strong>Exactly<\/strong> 2,753, three times over. That&#8217;s not a coincidence and it&#8217;s not a data problem \u2014 that&#8217;s a machine, stamping the same twenty-three forms two thousand seven hundred and fifty-three times in a single day. The client&#8217;s frame fell apart in my hands. The calibration notices weren&#8217;t garbage worth throwing out. They were <em>twenty-three true things<\/em> drowned in a forgery.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now I knew there was a forger in the building. And I knew exactly which room to kick down.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">X. The Two Perps<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The forger was the calibration check \u2014 <a href=\"src\/my\/com\/nextsense\/j0052_jps_rhn\/server\/app\/houseKeeping\/HouseKeeping.java#L306\"><code>doNextSensorCalibrationCheck<\/code><\/a> \u2014 a clerk who was supposed to make his rounds <em>once a day, at seven.<\/em> And he had two problems, and the two of them together were homicide.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Perp One \u2014 the missing keystroke.<\/strong> His appointment book, at <a href=\"src\/my\/com\/nextsense\/j0052_jps_rhn\/server\/app\/houseKeeping\/HouseKeeping.java#L79\">line 79<\/a> and again at <a href=\"src\/my\/com\/nextsense\/j0052_jps_rhn\/server\/app\/houseKeeping\/HouseKeeping.java#L159\">line 159<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>next = today 7AM;\nif (nextSensorCalibrationCheck.isAfter(now)) next = next.plusDays(1);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">One character missing. A <code>!<\/code>. The blast had it. The password mailer had it. This clerk didn&#8217;t. So the moment the clock ticked past seven, he&#8217;d write his <em>next<\/em> appointment for <strong>today at seven<\/strong> \u2014 a time already in the past \u2014 and the beat, coming around every second, would see the overdue appointment and send him in <em>again.<\/em> And again. And again. All day long. The confession was right there in the log, if you knew to read it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Jul 30 08:00:01  next SensorCalibrationCheck scheduled for 2026-07-30T07:00<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Next<\/em> run scheduled for 07:00, logged at 08:00. He was booking appointments in the past. Two thousand seven hundred and fifty-three of them a day.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And the sick joke? The git blame showed a commit \u2014 <code>5eab36e<\/code>, <em>&#8220;Fixed the same for nextSensorCalibrationCheck&#8221;<\/em> \u2014 that swore this exact bug was already dead. It wasn&#8217;t. The fix never landed on this line. Somebody signed the death certificate for a suspect who was still walking around.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Perp Two \u2014 the alibi that always held.<\/strong> Fine, the clerk ran a thousand times a day. He was <em>supposed<\/em> to notice he&#8217;d already filed today&#8217;s report and skip it. His check for a duplicate, at <a href=\"src\/my\/com\/nextsense\/j0052_jps_rhn\/server\/app\/houseKeeping\/HouseKeeping.java#L336\">line 336<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\" AND status != ?\"     \/\/ status != 'AutoClosed'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Newborn notifications come into this world with a <code>status<\/code> of <code>NULL<\/code>. And in the cold arithmetic of SQL, <code>NULL != 'O'<\/code> isn&#8217;t <em>true<\/em> \u2014 it&#8217;s <code>NULL<\/code>. It&#8217;s a shrug. So every time the clerk asked <em>&#8220;did I already file this one?&#8221;<\/em> the ledger shrugged, and he filed it again. His own fresh paperwork was invisible to him. The perfect crime, committed against himself, a thousand times before lunch.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The tell was two doors down. The station-down clerk asked the <em>same<\/em> question the <em>right<\/em> way \u2014 <code>status IS NULL OR status = ?<\/code> \u2014 and his numbers were honest: 797, not four hundred thousand. One clerk who knew how to check his own work, and one who didn&#8217;t. That was the whole difference between a quiet night and a corpse.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Two perps. A missing exclamation point and a NULL that always shrugged. Between them they forged a quarter-million documents, buried the night watchman under the weight, and let the whole building believe the mail just <em>sometimes didn&#8217;t go out.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Case closed. Now came the part nobody writes songs about \u2014 the cleanup.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">XI. Cleaning Up the Bodies<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You don&#8217;t leave four hundred thousand forgeries in the evidence room. One transaction, reviewed twice, run once:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>UPDATE notifications SET status = 'O'\nWHERE notification_type_dict_key LIKE 'CALIBRATIONDUE.%'\n  AND (status IS NULL OR status IN ('I','N'));<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Four hundred thirty thousand two hundred eighty-four rows, closed. Nothing deleted \u2014 just filed away as history, the way you&#8217;d zip a body bag, not burn it. The blast&#8217;s morning load dropped from <strong>431,170 rows to 886.<\/strong> The watchman&#8217;s beat got light again. The twenty-three honest warnings would be reborn clean at the next seven o&#8217;clock, the way they always should have been.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">XII. Insurance<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A good detective doesn&#8217;t just close the case. He makes sure the same killer can&#8217;t work the same building twice. Five locks on the door, shipped in two commits \u2014 <code>10f87e1<\/code> and <code>fcabece<\/code>:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>The net that catches everything.<\/strong> Every task now catches <code>Throwable<\/code>, not just <code>Exception<\/code>, with a backstop wrapped around the whole beat. An <code>Error<\/code> can no longer walk through the net and carry the watchman out the back. He logs it, he shakes it off, he keeps walking. No more silent bodies.<\/li>\n\n\n\n<li><strong>A lighter load.<\/strong> The blast builds its summary table <strong>once per language<\/strong> now, not once per recipient. The thing that swelled to eleven seconds and then to a coffin \u2014 put on a diet.<\/li>\n\n\n\n<li><strong>The missing keystroke, restored.<\/strong> <code>!nextSensorCalibrationCheck.isAfter(now)<\/code>, at both scenes of the crime. The clerk makes his rounds <em>once a day.<\/em> The 2,753\u00d7 forgery machine is scrap.<\/li>\n\n\n\n<li><strong>A ledger that can&#8217;t shrug.<\/strong> <code>status IS NULL OR status != ?<\/code>. The clerk can see his own paperwork now. He files each report exactly once.<\/li>\n\n\n\n<li><strong>The evidence room, cleared.<\/strong> The backlog closed, the open set back down to human numbers.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">And a note left for the next detective, the leads I didn&#8217;t have time to run down: put a <strong>timeout on that mail room<\/strong> before it hangs somebody. Give the watchman a <strong>query timeout<\/strong> so a jammed door can&#8217;t freeze him either. Write the blast&#8217;s last-run date in a <strong>ledger that survives a restart<\/strong>, so a cold start knows what it missed. Wire a <strong>dead-man&#8217;s alarm<\/strong> to that sixty-second pulse, so the next time the watchman drops, somebody hears it <em>that morning<\/em> \u2014 not two days later. And somewhere in that <code>stations<\/code> table are a handful of sensors due for calibration on <strong>January 1st, 2070<\/strong> \u2014 a date that&#8217;ll never come, on notices that&#8217;ll never close. Somebody should ask them what year they think it is.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">XIII. Case Closed<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s what it came down to, when you burn off the fog.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A server that was never down. A watchman who was never fired. An email that just <em>sometimes didn&#8217;t go out.<\/em> And underneath it all, twenty-three honest little warnings about rain gauges past due \u2014 taken by a clerk with a missing exclamation point and a NULL that always shrugged, forged a quarter-million times, and piled so high they crushed the one man walking the beat. He died mid-sentence at eight in the morning while a <code>finally<\/code> block cheerfully scheduled a tomorrow he&#8217;d never see, and the building kept its lights on for two more days without ever noticing the dark.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Six theories I chased died before this one confessed. The restart that never happened. The mail room that never hung. The nine o&#8217;clock mailer, innocent. The file-cleanup job, never in the room. The NULL timestamps that weren&#8217;t NULL. The field crews who never touched a thing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s the job. You follow the easy lead until it lies to you, and then you follow the next one, and you keep going until the log tells you the truth in eight lines it had been holding the whole time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The mail goes out at eight now. All 886 rows of it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I flicked off the desk lamp and left the watchman to his rounds.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>\u2014 filed under <code>OutOfMemoryError<\/code>, the last day of July.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just fed claude my logs and source code for an ancient project that was causing problems &#8230; daily notification emails not going out on some days. Wasn&#8217;t getting far with Sonnet, so I&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":9615,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[127],"tags":[],"class_list":["post-9614","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/blog.shahada.abubakar.net\/index.php?rest_route=\/wp\/v2\/posts\/9614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.shahada.abubakar.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.shahada.abubakar.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.shahada.abubakar.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.shahada.abubakar.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9614"}],"version-history":[{"count":1,"href":"https:\/\/blog.shahada.abubakar.net\/index.php?rest_route=\/wp\/v2\/posts\/9614\/revisions"}],"predecessor-version":[{"id":9617,"href":"https:\/\/blog.shahada.abubakar.net\/index.php?rest_route=\/wp\/v2\/posts\/9614\/revisions\/9617"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.shahada.abubakar.net\/index.php?rest_route=\/wp\/v2\/media\/9615"}],"wp:attachment":[{"href":"https:\/\/blog.shahada.abubakar.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.shahada.abubakar.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.shahada.abubakar.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}