Live data from Hacker News

Ask HN: What is the funniest bug you encountered?

news.ycombinator.com

31–40 of 66 posts

Re: Ask HN: What is the funniest bug you encountered?

#33
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...

Re: Ask HN: What is the funniest bug you encountered?

#34
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.

Re: Ask HN: What is the funniest bug you encountered?

#35

Earlier quoted context omitted.

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.

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.

Re: Ask HN: What is the funniest bug you encountered?

#37
post #26

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…

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.…

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.

Re: Ask HN: What is the funniest bug you encountered?

#38

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…

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.

Re: Ask HN: What is the funniest bug you encountered?

#39
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.

https://imgur.com/a/fyu0D

Re: Ask HN: What is the funniest bug you encountered?

#40

Earlier quoted context omitted.

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.
Post reply on HN