Ask HN: What is the funniest bug you encountered?
31–40 of 66 posts
Re: Ask HN: What is the funniest bug you encountered?
#32Re: Ask HN: What is the funniest bug you encountered?
#33Re: Ask HN: What is the funniest bug you encountered?
#342nd 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?
#35Earlier 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.
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?
#36Keyboard not found Press F1 to continue
Re: Ask HN: What is the funniest bug you encountered?
#37An 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.…
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?
#38An 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…
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?
#39Re: Ask HN: What is the funniest bug you encountered?
#40Earlier 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.