What’s The Most Mysterious Bug You’ve Ever Encountered In Your Own Code?

This thread got me pondering about mysterious bugs that I’ve encountered. I saw one “odd” bug where I could not debug certain value that got carried over network, but the game just kept crashing.

After a bit of debug… I spotted that I was editing the wrong function (and was too stubborn to take a very little time to step through & use breakpoints to get it solved – I thought I “knew” where to problem lied already).

But that perhaps wasn’t so mysterious.

You have some strange bug experiences to share?

P.S. the spam contest ends pretty soon… take your guess if you want to get this cold drink. Beer-worth tip: nobody has not tweeted it only one or two has tweeted about it, so there’s a pretty easy drink available.

10 thoughts on “What’s The Most Mysterious Bug You’ve Ever Encountered In Your Own Code?

  1. When I was making an A-Life simulation program for my Master of Science degree, I had plenty of amusing bugs in process.

    Raptors walking on water, predator rabbits, extremely fast movement/reproduction and so on. Most of these bugs were easily fixed, but it was fun to watch it all go wrong.

    As for mysterious bugs, can’t think of any.

  2. All right, I’m probably the person who saw the weirdest bug in his code.

    That’s because it was a real bug! A tiny little bug, smaller than a pixel, walking all over my code, on the inside of the LCD monitor, between the image and the transparent foil. I decided not to bother the little fellow. It took a few walks around the screen and the next day it was gone – it seemed it could get off screen, inside the monitor, only through the left lower corner.

    The whole company witnessed this :)

  3. My most mysterious bug happened long ago, I guess 1993 or so. Porting a program from FORTRAN (on 3090) to C++ (on RS6000) I knew what an expected result should be, and I wasn’t able to obtain it! This thing was a monte-carlo simulation used for computing a near-optimal solution for a specific optimization problem… but I couldn’t get down close enough to the solution.

    So I went debugging for about 7 days filled with frustration, discovered a series of little bugs (including a hardware-bug on that CPU which would yield wrong results using float in the multiply-and-add instruction which was unique to that CPU at that time), but I never found all the bugs. I decided to re-implement the relevant sub-system, and at the end of the week everything was running fine.

  4. @Rob: Auch. :)

    By the way, that’s why I added some debugging code in my network stuff right from the beginning (I’ve reserved certain slots for all network objects for debugging info)

    @Dave: that’s a wonderful story – tweeted! :D

    @Pathogen: No expansions for that game then…

  5. Rob’s story reminds me of an issue I had in my old DtD Tower Defense I made in Game Maker. There was a bug where enemies stopped spawning after like wave 99 or something. However, if I manually made it start on Wave 99 everything was fine. Turned out there was some weird glitch in the logic for making a certain type of enemy more frequent that made them disappear after too long. I don’t remember why setting it up to start on wave 99 didn’t work, but I ended up having to play the game for 99 waves >.<

  6. The day I discovered that sheep were evil.

    In Golemizer sheep produce wool through some kind of mini-game. Basically players just have to take care of sheep on a daily basis to get wool from them.

    Basically the sheep were accessing the database way too frequently to update the “wool status” which lead the SQL 2005 Express temporary system table to explode.

    Full story here: http://www.golemizer.com/index.php/forums-v3/viewtopic.php?f=12&t=3492&p=14611&hilit=sheep%20are%20evil#p14608

  7. I was working on a well known racing game which very rarely would crash in wireless internet multiplayer. Only with a full 8 player game. So I set up 8 devkits and started running the game over and over trying to reproduce the bug. It took a mind-numbing 57 tries, but I finally had the bug occur for me. A packet was coming late and triggering a rarely used section of code with a crash bug. It took a further 21 times to reproduce the bug again to verify the fix.

  8. Pathogen: I bet that was a pretty nasty thing to debug! :D

    Heh, this actually reminded one totally mysterious bug I had with Leadwerks. I could not draw help texts in non-debug mode unless I had created a separate variable for the entity. It’s hard to explain, but tried to do that here.

    @Carlos: Hehee, copy-paste is evil ;)

    Funny, but the moment I write about “mysterious bugs” I encounter one in my code! Two minutes ago, I managed to solve this strange this:
    - when spawning an enemy, it goes smoothly on client machine IF the enemy goes to left. The moment the enemy starts to move to right, it starts to look like it’s lagging. I could not understand what was causing this until I finally spotted that only server needs to call “updateAI()”, clients don’t need to do that… :)

  9. A copy-paste bug in a function where I was calculating the triangle deltas in a real time software renderer, when I was at university.

    The bug was in a tiny auxiliar math func, in another file, and I could not find it until, weeks later, I went to explain to a friend how phong works. It was something like: “First you must calc the triangle deltas…. Ey, what is it doing there that J?

  10. lol, similar to Cliffski, I have had some issues with threads. We had an issue in our engine where if the GUI renderer (Which is done by Google Chromium in a separate thread) triggered a callback. In OpenGL mode the game would crash, but not in DirectX mode! Visual Studio even reported the callback was getting run in the correct thread, but for some reason it seems it just didn’t like the thread access with the texture.