from Hacker News

Ask HN: Favorite Debugging Story?

by hahnchen on 9/30/23, 9:05 AM with 8 comments

Share some of your favorite one’s! I’d love to see systems programming debugging stories.
  • by AlexITC on 10/2/23, 10:18 PM

    There was a time I had a tricky bug to solve, a important email wasn't being delivered to customers, I had to do this to discover the 1-line change:

    1. Simulate the email and check whether it was being received by the mail provider (Gmail), turns out that it was received by Google but Google spam filters rejected the email, we could see the sender/subject but we couldn't see the content.

    2. Print the email content in the code just before sending it, all seem correct here.

    3. Do monkey-patching to a Ruby library that was in charge of sending the email to the SNTP server, println says that we are sending the right data.

    4. Capture the traffic (Wireshark) sent by the app to the SMTP server just to make sure we are sending what needs to be sent, turns out that the email content wasn't what I expected, it was something like a Ruby object's default hash + some weird characters.

    Apparently, the library in use wasn't working with the object we were sending, which caused the email content to become a random string, this triggered Google spam filters causing it to reject the email, the solution was as simple as changing a line from `email.body` to `email.body.string`.

  • by oliverpk on 9/30/23, 8:22 PM

    It sounds really stupid now, but I was working with threads in Java. There are two ways to implement a thread, either implementing the interface runnable or extending the class thread. I originally had a class that implemented runnable with a custom method called getState(). To initialize a thread while using runnable, you have to pass the runnable object to a thread as a constructor parameter. The class thread also has a method called getState() and I spent an embarrassing amount of time wondering why I had totally different values than expected.
  • by dcminter on 9/30/23, 3:48 PM

    Off-topic out of the gate, I'll recall that on my very first attempt to write a program in Modula II on our university's Vax, I accidentally inserted a # character at the top of the file. The compiler output wasn't very user friendly, and I was relatively green at interpreting compiler output anyway. So the fact that basically every line of my program was considered a syntax error was deeply baffling to me. It was a long day (and evening) in the lab before I figured that one out. I expect it was character building. Or something.

    A bit more on-topic, although this one is not strictly my story: at British Airways, working on the cabin crew's manifest documents, we had an issue where the printout kept aborting a short way in. It turned out that any time a sick passenger needing special assistance was noted in the records the problem would occur. After a lot of head scratching someone (not me) spotted that there was a special handler to end the printout if there was an "INVALID" field in the dataset and the test literally said something like:

      if(contains(recordset,"INVALID")) exit;
    
    Invalids, therefore, were a problem :)

    For anyone confused, note etymology #2 here: https://en.wiktionary.org/wiki/invalid

  • by trumbitta2 on 10/2/23, 1:10 PM

    That time I discovered that a specific (since forgotten) version of Webpack would crash and burn if I imported an SVG icon with the word "add" in its file name.

    Took me 5 days to find it. 30 seconds to fix it. (add.svg --> plus.svg)

  • by vpaulus on 10/2/23, 1:25 PM

    Happened to me not once and not twice: Editing local code, but checking changes on the remote server. And going crazy, why nothing changes?
  • by eimrine on 9/30/23, 9:09 AM

    On my first programming lesson I could not figure up how to store some content with NULL bytes (such as a webpage) in C++ string and the teacher did not know it either.
  • by watters on 10/3/23, 12:02 AM

    I'm not sure if this qualifies, but I found it interesting at the time I solved it (Spring 2011?): https://cameronwatters.com/writing/2017/08/01/take-the-time-...

    TL;DR (of the problem): customers from a single country—and only that country—were (sometimes) unable to checkout on an e-commerce website and, after months of trying to sort out the issue, the solution turned out to be very facepalm-worthy.