Ask HN: What is the funniest bug you encountered?
One amusing one springs to mind: an image thumbnailer on a website for a very popular all-girl band. It was "smart" and cropped images to the right aspect ratio based on entropy in the image. In practice, this manifested itself as a foot fetish – if a photo included feet, it would centre the thumbnail on the feet almost every time. The gallery index pages looked quite odd.
I built a similar tool early in my career, only it used facial detection with haar cascade classifiers. It was kinda poorly written in PHP but it worked!
One I wrote myself. Frustrated with some bizarre bug that I struggled to reproduce, I added two popups, to two separate conditionals that should have been exclusive (either one or the other executes, but never both). The first one said "What", and the second one "the fuck". I eventually managed to get both to show up, correctly forming the expletive, but it wasn't enough to help me solve the bug. There were more bugs though, had to get the ticket list down, so I dropped it and went after some lower-hanging fruit.
A week later, our dev team gets sent a chain email with two screenshots, and a brief comment from the lead saying "This should never happen." In the first screenshot, was my "What" popup. I didn't need to see the second one.
Turns out, when I moved on to other tickets, I completely forgot I had left that code just lying there, instead of discarding it, and had even pushed it with nary a thought. Nobody else on the dev team had seen either popup. No one in QA saw them either. And so, it made it all the way to production, where one of our users (mercifully, an in-house one), promptly caught it.
The dept head thought I was committing sabotage, given the very specific set of actions one had to take to see the effect, but thankfully everyone knew that it was too stupid to do something like that via commit into repo! At the least, my frustration at the bug proved justified.
A classic one ! Once I did the same one, just an echo in a php page. It was at the bottom of the page, after the footer. It was a job for a web designer I was helping.
It's his son who saw it. So we removed it before the client (or anyone, it was in production) feedback to us.
Bullet dodged !
This isn't exactly side-splitting, but my home isp, virgin media uk, does dns hijacking for domains they cannot resolve. If you try to access http://bugzilla.anynonworkingdomain.com for some reason it interprets that as a search for the term "porn". I have lots of tabs open to our bugzilla in work (where bugzilla.mycompany.com resolves correctly) so when I take laptop home, open it up and chrome refreshes tabs it looks like I have opened 20 tabs searching for porn.
Interesting, seems to only trigger when the search term contains the substring 'bugzilla' exactly:
http://advancedsearch2.virginmedia.com/main?FailedURI=bugzil...
I had this bug that can reproduce only on a specific hp notebook, after running certain stress test for days.
The issue (a crash) was in a device driver we were developing, but the root cause was because 1 single bit in the host memory was flipped randomly.
My coworker joked that this bug was due to strong sunspot activities during those days (We indeed saw news about strong sunspot activities at the time.), so that strong universal radiation altered the data on the memory. I guess that batch of memory the notebook used had some issues.
My background is purely software, I always thought that computer hardware is rigid and trustworthy. But I learnt from this bug that it's not always the case.
I had a similar one (almost 20 years ago!) where I came back from lunch to a panic about all the sites being down.
The errors on all the sites were reporting a broken sql query - something like "select * from qccounts...". I guess the way ASP worked meant that the code was stored in a common location in memory for all the sites.
I like to imagine some cosmic event millions of years ago flipped that bit...
That's what we want you to think, but the hardware is at least as much of a mess as the software
Any sufficiently advanced technology is indistinguishable from chaos.
Oh, wait, those were regexes.
Not really a bug, but..
An early release of our product (not to be named), contained a database that contained a perl script that was written out to a web server. The person who took over maintaining this script looked at the original author's code and put a comment line in containing the descriptive phrase "Chicken Goat Fuck Logic" (aka "CGF Logic"). We accidentally forgot to remove that comment before producing the "gold" CD.
A couple of weeks later, a very large national youth organization (also not to be named) contacted us, saying they would be unable to use our software, because their CyberNanny software had detected swear words in the output.
Arguably, if this hadn't happened, we would have become Amazon before Amazon became Amazon. Ooops!
Rather humorously, it appears the person who wrote the script created this website to commemorate the birth of CGF Logic : http://chickengoatfuck.com/
why not named?
An embedded system written in C++ had a Singleton. The Singleton pattern means that you have one instance, which has to live somewhere. This implementation had the instance as a static variable in the getInstance() method, e.g.:
Foo* getInstance()
{
static Foo;
return foo;
}
This is perfectly valid.Unfortunately, getInstance() was implemented in Foo.h, not in Foo.cpp. But in C++, functions in header files are inline by default. This means that every caller of Foo::getInstance() wound up with their own "static Foo" in their own inlined Foo::getInstance(), which meant that each caller got a different instance of the Singleton.
Most interesting bug I've seen in ten years.
Love the bug and it's been a while since I've done anything in C++, but isn't your description slightly wrong? There would be one instance per .cpp file that #include'd Foo.h, not one per getInstance() call. I don't think that "inline by default" is an accurate description of what would happen, and I have to imagine that if inline-ing a function caused different behavior, then that would be considered a compiler bug. Rather, I assume you mean it was "inlined" into the file at the #include point (and not once per call). Not that any of that changes the bug qualitatively.
No, inlining replaces it at the place of call. Every call, even if there's multiple of them in the same file. The idea is that, by putting the implementation in the .h file, you're signaling that you don't want to pay the overhead of the function call. (Same thing with the "inline" keyword.)
Now, if your function is sufficiently complicated, the compiler may choose to not inline it anyway (with the definition of "sufficient" being compiler-dependent).
It could be considered a compiler bug that a function with a static variable in the body could be inlined. As you say, that changes the behavior of the function. Or perhaps it could be considered a specification error - I don't know if the standard prohibits inlining in this circumstance, but perhaps it should.
Now, C++ explicitly allows shouting yourself in the foot for performance reasons and for interesting features. You might actually want to have such code to programmatically create such static fields.
In a template tracking usage of the class is a common case. Another fine one would be to count separate instantiations. (How many times the function was used not inlined vs inlined.) Etc.
> A static local variable in an extern inline function always refers to the same object. > 7.1.2/4 - C++98/C++14 (n3797)
(functions are by default extern, so, unless you specifically mark your function as static, this applies to that function)
What the OP did should be fine and not cause an issues. The only way it could cause issues if they also made the function static.
Clarification: Are member functions by default extern?
If so, then it's a compiler bug, and I figured it out because the compiler did what I naively expected, rather than what the standard said.
Now I'm googling this and it looks like what you wrote would be a compiler error (assuming Foo.h was included into at least two files) unless the keyword inline was used so that the same function could be defined multiple times. That clears up my confusion with your "default inline" statement.
Ahh the fabled Multiton pattern. The similar ones are:
Making the singletons in shared objects, each one gets it's own. Adding a destroyInstance method.
I've actually used a destroyInstance method, for testing. But if you do that, first, nobody can hang on to the pointer they get from getInstance, ever, anywhere in the entire code base. And second, the instance has to be a pointer (so that destroyInstance can delete it), and destroyInstance has to NULL the pointer. Then getInstance has to create a new instance if the pointer is NULL.
It can be done, but if anybody ever calls destroyInstance in production code, well, I question their approach...
Ten years from now, A⍰ may look back on A⍰t and laugh, but for rA⍰ght now, there A⍰s nothA⍰ng funny about A⍰t!
When I was young I wrote a system that had an error message that was "I'm sorry Dave, I'm afraid I can't do that" for a small local business (back in the 90's).
6mths after it was in production I got an email saying "The system won't work and it keeps calling me Dave!, I'm not called Dave, my name is Chris!".
Lesson learnt right there, never put funny error messages in with the intention of replacing them later and never swear in error messages.
Today I noticed that the longer my game ran, the faster all the animations ran. At first I thought I was imagining it. I had accidentally find/replaced the delta time since last frame with time since app start.
"ERROR: Task completed successfully"
This is actually really common. I can't remember if it's Linux or Windows specific, but it is almost always caused by code like this:
What happens is that the call to `do_something_else()` calls another system call, which completes successfully. Unfortunately, system calls just return a success or failure code, and store the actual detailed error number in a shared global variable. So, when the handler code goes to retrieve the text message describing the error, it ends up looking up the code for the status of the second system call. But when that returned it saved the code for 'Task completed successfully' over the first error code the developer actually wanted...result = some_system_call(argv); if (result == ERROR) { do_something_else(); error_message = get_text_for_last_error(); display("ERROR: " + error_message); }I think it's probably Windows, maybe the `perror()` call, that does this?
you got my vote for funniest here so far :)
A finance quant created a strategy with amazing results. He discovered the theory, tested it, refined it, and set up a presentation to the portfolio manager to start running it. problem was that he inverted PnL, and had spent the previous couple weeks figuring out how to maximize losses.
INBF "do the opposite." Markets don't work that way.
What Silicon Valley startup did he land in after he was fired?
A cluster of 10+ machines was processing data for a whole week (7 days). Think Hadoop with counting and grouping numbers. The output was slightly over 2GB. The user specified his home directory as output. The home directory was NFS-mounted and didn't support files over 2GB, thus no file was written and the job had to be rerun.
There’s a similar right of passage for Deep Learning engineers using python and Keras - every single one of us has been burned by waiting for a week for a model to train, only to find “h5py” is not installed, exception is thrown and all work lost. (That’s the python module used for persistence of the model weights)
Then the young grasshoppers learn about checkpointing and using our dev ops systems to make sure the environment is up to spec, but I feel this has to happen at least once to each Deep Learning researcher
Something very similar happened to me. To this day, I don't run any python script without the `-i` flag
Tester worked a later shift (noon to 8pm) and was running scenarios. Got a really odd error that made contracted pricing incorrect. Developer came in the next morning and ran the scenario just fine. Tester repeated the scenario at 6:30PM and got the same error. Both thought the other was nuts and this went on for a week. Found out it was an interaction issue when using the time (UDT) to get the current market date.
Lesson: if anything goes wrong at night but not during the morning, look at all the date code.
I also found a test breaking on Mondays. Never on any other day. It tested a sum for the current week but made the mistake of creating models for "yesterday" which is on another week if it's the first day of the week (depending on location, Monday in Europe, Sunday in the USA).
Had an office where, every Thursday, one developer's machine would reboot at the same time late in the evening. It didn't happen to anyone else. Eventually he decided to stay late one Thursday and watch it to see what happened.
At the appointed time the cleaner came by, unplugged his machine from the power socket and plugged in the vacuum cleaner to clean the room, and when done, plugged the machine back in.
Heard a similar story about a laboratory system with tight environmental controls. Every so often the humidity would spike and the room would go out of tolerance after typical work hours. The designers of the system were under quite a bit of pressure until someone finally stuck around long enough to catch the janitor mopping the floors.
Some decades ago, friends of mine ran an ISP that resold bandwidth from another business. They used a leased line to the business, and every Friday evening at about 7.30 their connection dropped out.
It turned out that the cleaners at the remote end would plug their vacuum cleaner into the same circuit that was powering my friends' hardware. The power surge caused their hardware to crash, and nobody had access to properly reboot it until Monday 8.30am.
I once worked on a retail time management game. The doors of your store would open and then close when the customers came in. After a while, the doors would just start swinging open and closed all the time, like the store was being visited by a vengeful ghost. We never did figure out what caused that.
This next bug (in the same game) we purposefully left in and it became an easter egg. A big part of the game was being able to customize your store with different retail stands and tables to put your merchandise on. If you edited your store layout while customers were in the store, you could trap them. The path finding code we wrote for the customers required a valid point of entry and a valid point of exit to the store. As soon as you trapped the customer, the lack of valid path to an exit had an unusual effect on the character animation. The character movement and animation speed would increase up to 2x, which made the customer look like it was freaking out. It also negatively effected the customer "happiness" state. A store's reputation score was based on the average customer happiness level over a particular time period. A trapped customer could absolutely destroy that score. I've seen it drop from 2000+ to 0 in seconds. As with the other bug, we never did figure out why this was happening.
tl;dr If you have an Enum don't have the 0 value be semantically meaningful.
2nd tl;dr If sex/gender is an Enum you should have at least 4 values unspecified, female, male, other.
A few years ago I was working on a front end that talked to different scheduling software systems. Our front end had a much more nuanced way of representing sex/gender while the system that talked to scheduling systems had an older enum
Bad_Gender { female = 0, male = 1, }
A bug was introduced such that no gender was set. However the field not being set meant that it's value was 0. This led to all appointments being booked as women. Even a prostate exam. Needless to say we fixed the bug quickly.
It wasn't funny at the time. I helped develop and app + hardware for measuring the force generated when luge / ski cross / boarder cross athletes start. The handles measure the force and sent the data to an iPad which also recorded video.
Worked fine in the office. Every time we went up on the mountain to test, the video didn't work. Go back to the hotel it worked fine.
Whole project was going to fail because of this. Finally it worked once on the mountain, so we proved the system could work.
Finally I found the bug. When setting the video orientation, I was passing in device orientation instead of UI orientation. In my office, I always have my iPad on a stand, so device orientation matched ui orientation and everything worked fine.
When I was on the mountain, I held the iPad flat so I could shield it from the sun with my body, then I'd lift it up when the athlete was about to start. The video would fail to record if device orientation was 'down' since that isn't a valid orientation to rotate video.
I only ended up finding it because I ended up leaving my iPad stand at home one day.
I was in Rome a while back and wanted to go see Michelangelo's David. Searched for "David of Michelangelo" in Google Maps for Android. Clicked details. The main detail photo's aspect ratio is very tall and--because the photo is center-cropped--results in a zoomed in look right below his waist. :) Gave me a laugh. It's still live...
A bug that occurred only on Wednesdays: https://gyrovague.com/2015/07/29/crashes-only-on-wednesdays/
Back in the late 1980's, apple released a version of Unix called A/UX. In order to get excitement going about it, they sold Macintosh computers with A/UX preloaded to developers. The combo was cheaper than the equivalent Mac. So I bought two of them. I also bought the biggest displays for them; they weighted like 50 lbs. Probably 400 x 512; I don't remember. Anyway, I hooked both up to their displays and both booted to this message:
When in Danger
Or in Doubt
Run in Circles
Scream and Shout!
Apple eventually admitted that A/UX didn't support those giant monitors. I installed Mac OS and it ran fine.
As an undergrad doing an internship helping some PhD students write a complex MATLAB simulation. Part of the simulation needed to be done in a loop and, naturally, I used "i" as the index variable. I spent several days debugging why the expected output result was not correct.
Turns out there were some calculations using complex numbers (e.g. `x = 2 + 3*i`) and MATLAB decided that I obviously wanted to redefine the imaginary number constant in the loop. It was not very funny at the time.
Not strictly an error or bug, but rather the cause of one.
Back in my ISP days, we sold IPTV packages, which we in turn received from the IPTV company via satellite. And because of this elaborate distribution method we would get THE BEST outage/disruption notices.
For example;
"Urdu News will be unavailable from approximately 1AM GMT to 8PM, due to HIGH ENERGY SOLAR ACTIVITY."
How much better is that than telling your customers "Your news is unavailable because Barry doesn't understand BGP"?!
A different kind of bug https://www.npr.org/sections/krulwich/2013/06/19/193493225/t...
So we have a channel in Telegram that mirrors hackernews... and this just happened so I guess it's a nice meta bug?
https://i.imgur.com/JtbCGkB.png
(Disclaimer this doesn't happen, like ever)
> What is the funniest bug you encountered?
Spiders.
Customer put one of our server in a shack outside the main building. Spiders and other bugs got in the server causing the hardware to fail. We never never thought of testing our against an arachnid infestation.
Did not happen to me, but it's really baffling! https://www.ibiblio.org/harris/500milemail.html
I know Trey Harris. I remember when he first posted about this. I was the Sr. Internet Mail Administrator for AOL at the time, and I just about passed out from laughing so hard.
Accidental vertical farming on an old version of farmville caused by a race condition due to slow satellite internet speeds. You could take valid actions that would otherwise be mutually exclusive.
Wrote a rate limiter in C. It broke when time got adjusted due to day light savings . Didn't take into account negative time delta. It was an ahuh moment when I realized the next day
Relevant XKCD: https://xkcd.com/1883/
And yes, I do hate working with timezones - and so does everyone else I guess, Outlook still fails to correctly send appointment invites across timezones when DST is involved.
UTC FTW!
Keyboard not found Press F1 to continue
This one actually makes sense. You can connect a keyboard later or send the key code over remote interface or serial port.
I once worked tech support in a Fortune 500 enterprise software company where I got a support call that traced back to a syntax error causing a crash in the Perl install script of our flagship product.
Only “funny” because it's a phenomenally expensive product with on paper substantial QA/QC, and yet somehow it got into release with an install script that was guaranteed to fail.
In a chemical simulation with OpenGL animation of molecules crashing into each other we used the wrong sign for the vectors after colliding. Instead moving in the opposite direction the molecules started to glue to each other. They kept moving around in ever growing chunks with wild psychedelic shapes.
We kept this bug as an easter egg.
For some reason, in some astrodynamics calculations, I multiplied by r^2 rather than dividing, and since r was on the order of 10^8, the answer was off by 32 orders of magnitude.
(Yes, I now know about changing the units so that the numbers aren't so big; this was before I understood all that.)
Reset line for an embedded device coupling onto another line, error caused by noise on line was detected and handled in the debounce time for the reset line. Caused reset reason to report as an error even during normal resets.