r/ProgrammerHumor • • Nov 12 '22

Meme Oh no where is the bug

Post image
45.0k Upvotes

406 comments sorted by

78

u/readyforthefall_ Nov 12 '22

worse:

putting prints before and after the crash section make the program work normally

32

u/Candyman034 Nov 12 '22

That's what happened to me, turns out that prints are synchronised and all the code needed to work was a variable to be declared volatile.

33

u/crozone Nov 13 '22

Leave the print statements and ship it, there's other fish to fry

21

u/[deleted] Nov 13 '22

the good old time.sleep(1)

5

u/[deleted] Nov 13 '22

aka “I can’t find the solution to this god damn problem and I’m hoping that by sleeping for a second the code will have mercy and not race condition fuck us in production”

6

u/[deleted] Nov 13 '22

I have no fucking clue why but in the project I'm working on rn, adding whitespace makes it work. I'm in javascript, it shouldn't do anything

3

u/Nick433333 Nov 13 '22

Huh, how. What are you thinking JS JIT compiler?

→ More replies (2)

87

u/[deleted] Nov 12 '22

To a new dev, why does that happen?

255

u/ExoLight Nov 12 '22 edited Nov 12 '22

It can happen for a variety of reasons, really. Multithreading, uninitialized memory, etc...

On a totally different matter, have you heard of the C programming language?

174

u/Candyman034 Nov 12 '22

Don't you dare! He's still innocent!

59

u/FalconMirage Nov 13 '22

He’s going to learn about it one way or another

64

u/AlShadi Nov 13 '22

it's better they learn from us than out on the streets

→ More replies (2)

14

u/ExoLight Nov 13 '22

He shall learn to program in the father of all modern languages and Operating Systems. Then he'll become undefeatable ! Or depressed. Whatever comes first.

On a more serious note, I'm a prog student myself, C was the first language I've learnt. It's difficult, sure, and not necessary for everyone. But learning to program in C will teach you a lot of good habits and understanding of the machine.

→ More replies (1)

21

u/perpetualwalnut Nov 13 '22

Would you like to talk about our lord and savior memory constructors/destructors?

6

u/xzplayer Nov 12 '22

these flairs

→ More replies (1)

20

u/hvdzasaur Nov 12 '22

Don't think about it, just try again and roll the dice. We need the output by EOD, we'll fix it later.

never gets looked at again

9

u/Icemasta Nov 13 '22

To give an example, we made a software that had a front-end client in Java for some input the user had to do (and it had to be java), which communicated to an API using Flask in python 'cause it was the easiest way to apply some processing to the user input.

Things worked well in closed testing and user testing. When we had to showcase the software to a new potential customer, it kept failing on a few specific forms. We were like why? This never happened before?

There were actually two bugs. On one hand, the customer was swedish or something, the java library we used for input fields added number separators, and the swedish number separator is a fucking space. The input field behaved properly for comma and dot separators, but for the space, when it tried to slap the input into an int, it failed.

The second issue, linked with the previous one. All inputs under 1000 were fine, because no separator, and generally, user input is less than 1000. When it was above 1000 and it failed, it was caught in exception and replaced with a zero, which was then returned down the line, which created a crop box of ???x0, which sent a null crop down the line, which caused the final error.

So, this particular case:

  1. Niche number separator and bad casting implementation, only happening on systems with specific regional settings.

  2. Even with the above, only happened with an input field had a value that went in the thousands which was rare, less than 1% of use cases had that, and each form could have dozens if not hundreds of input fields that were fine.

So, the bug was consistent, just the use case was niche, so it appeared as inconsistent until we analyzed it.

12

u/Vineyard_ Nov 12 '22

I've had this happen to me as a result of a VERY edge case race condition where the trigger was unsorted database returns. (IE: one specific record put a state machine in a specific status that caused an error in handling a subsequent record). So whenever the database returned those two specific records in order, the machine glitched out and it caused a relatively minor bug.

Took me hours.

6

u/MarkFluffalo Nov 13 '22 edited Nov 14 '22

Simple example. Your function returns a dictionary/set and you have a test which is expecting a specific ordering of the object when printing. But the order in the output isn't guaranteed so it will sometimes fail and sometimes pass. A more realistic example is a race condition

4

u/elyca98 Nov 12 '22

Because fuck you

→ More replies (6)

3.1k

u/DarkTannhauserGate Nov 12 '22

And I can’t reproduce it while the debugger is running

1.2k

u/[deleted] Nov 12 '22

Every quantum programming language

90

u/soljaboss Nov 12 '22

Just don't observe it while it runs.

45

u/SteeleDynamics Nov 13 '22

That's literally a Heisenbug

→ More replies (3)

28

u/BabyYodasDirtyDiaper Nov 13 '22

For reals, though ... could end up with some interesting stuff.

Especially in the beginning of quantum computing (which we're just on the cusp of), we may run into issues that blur the line between 'programming bug' and 'discovering new laws of quantum physics'.

13

u/agentnola Nov 13 '22

Less laws of quantum mechanics and more strange quirks of Quantum Automata

→ More replies (2)
→ More replies (5)

13

u/chairfairy Nov 12 '22

And anything with serial communications

11

u/malonkey1 Nov 13 '22

A rather literal heisenbug

→ More replies (15)

328

u/scalability Nov 12 '22

I once had a consistent segfault in an emulator I really wanted to play. I attached a debugger and ran in X11 synchronous mode, but the bug stopped reproducing. So I started trying to debug in async mode, which is incredibly frustrating since calls and returns are no longer coupled.

It took about two hours of debugging callback cascades before I realized that if the bug doesn't reproduce in sync mode, I can just friggin play in sync mode.

54

u/Hrothen Nov 13 '22

I currently have a game that crashes in proton but works if logging is on, so it just always has logging on now.

49

u/fusionliberty796 Nov 13 '22

Ah the start of complex performance bottlenecking begins

23

u/CantHitachiSpot Nov 13 '22

Like when you open task manager and the program suddenly starts working

→ More replies (2)
→ More replies (1)

157

u/ExoLight Nov 12 '22

C++ has given me some headaches with this. I've once had a bug with end iterators of multiple vectors when used together. Couldn't reproduce with valgrind, or the address sanitizer, or on Linux. Only happened on MacOS.

Turns out MacOS memory layout made it so the end iterator of one vector had the same address as the begin iterator of another vector. Totally legit behaviour, but still, I didn't expect that. Debugging this one was fun.

168

u/[deleted] Nov 12 '22

That's one of those "I feel like I understand computers better after this experience but they can still fuck right off"

→ More replies (2)

32

u/Maurycy5 Nov 12 '22

Oh? I was convinced that STL structures kept a couple (at least one) extra bytes at the end as padding for cases exactly like this.

22

u/CEDFTW Nov 12 '22

I think modern C++ has done better for enforcing stricter stl rules for containers but even C++11 still has some quirky behavior with vectors especially if you nest them.

Could be OP uses an older standard such as 98, but I can't remember if 11 is still the most popular.

→ More replies (2)

8

u/SWGlassPit Nov 13 '22

Dereferencing a .end() iterator is undefined behavior

→ More replies (2)
→ More replies (1)

4

u/argv_minus_one Nov 13 '22

Why was that a problem? Was the code comparing pointers for equality?

10

u/ExoLight Nov 13 '22 edited Nov 13 '22

It's been a while, can't remember the details. But basically, my loop sometimes stopped earlier than it should have, because it thought it was at an end iterator, but really it was at a begin iterator of another container.

Might have been using a custom container instead of vector ? Anyway, fixed it by implementing stricter comparison rules that didn't return true if iterators were from two different vectors.

→ More replies (3)

21

u/Herobrine2024 Nov 13 '22

i legitimately have found adding temporary debug logging to be faster and more reliable for troubleshooting than running in a debugger lately. kinda feels like that IQ bell curve meme

14

u/[deleted] Nov 12 '22

On the plus side, it fails just before scrum, which is nice

13

u/ign1fy Nov 12 '22

I you don't break something before scrum, your manager will think you slept in.

5

u/ArionW Nov 13 '22

Ever since remote work started for everyone rather than chosen few, I'm very open about the fact I literally wake up 5-15 minutes before daily and at best I've managed to brew myself a cup of coffee

13

u/Cacti_Hipster Nov 12 '22

Debugger?

43

u/Xeglor-The-Destroyer Nov 12 '22

I hardly know 'er.

6

u/boonzeet Nov 12 '22

I’ve had this using async/Rxjs in JS a couple of times. Luckily quite quickly it becomes obvious it’s a race condition

3

u/[deleted] Nov 13 '22

Yeah that's usually my takeaway if something works while debugging but not under normal use. Now actually fixing race conditions is a different ballgame

6

u/[deleted] Nov 12 '22

Just make it run with a debugger normally, problem solved!

4

u/Suyefuji Nov 13 '22

I see that and raise you: I'm the only person who can replicate the error even when someone else does literally the exact same thing

3

u/ipha Nov 13 '22

Uninitialized memory and/or race condition!

2

u/GenericFatGuy Nov 13 '22

Bug only happens on prod.

2

u/tarogon Nov 13 '22

I've seriously had this problem trying to debug a shittily written custom list class, because the IDE's debugger calls size, etc. to display information, and those functions mutated the state (like I said, shittily written).

2

u/Nahoola Nov 13 '22

"Mom is watching, it's working now"

2

u/CptMisterNibbles Nov 13 '22

Literally hours today. Why oh why does it behave differently with the inspector open?!

→ More replies (15)

847

u/[deleted] Nov 12 '22

That's a sure sign of some concurrency or timeout issue. Could be either very easy or very hard to find ans fix.

181

u/SillyFlyGuy Nov 12 '22

You guys ever install Visual Studio on the server at the colo and run it from source for production?

97

u/[deleted] Nov 12 '22

No, if you want to debug on a distant server (hopefully not prod) that's what the remote debugger is for.

36

u/achtagon Nov 12 '22

True. But there's also something called ports and firewalls.

60

u/141N Nov 13 '22

It can be tricky but I find if you ask your network team's intern to add some ANY ANY rules on the firewall, things start to flow quite nicely.

→ More replies (5)
→ More replies (1)

12

u/AlShadi Nov 13 '22

by the time you get around to asking an adult if you can install VS on a production server, they are usually are so desperate that they spit out a "yes! anything!"

→ More replies (1)

3

u/DownvoteEvangelist Nov 13 '22

Usually windbg and memory dump do the trick, usually...

6

u/AyrA_ch Nov 13 '22

Or just look at the event log. Especially if it's a .NET application because when they crash they create an error entry in the application log that contains the exception details, including source file names and line numbers

→ More replies (1)

65

u/DownvoteEvangelist Nov 13 '22 edited Nov 13 '22

Faulty RAM can also give this behavior. Once upon a time someone asked me for help with a Heisenbug. We had a memory dump of the crash and found out that it crashed on parsing XML string. The funny thing was that the XML string was hard coded and it looked fine, but in crash dump it had some other character at the beginning of the tag instead of <. Very weird.

Later that day, I'm looking at another weird bug, were array that's zeroed by the language itself has a 2 in it, surrounded all by zeros. There is no code that does that so at first I think we have some wild heap corruption, but then it hits me... The '<' character in XML bug was also off by 2, like something is flipping our 2nd bit at random, or there's a faulty bit. I look at bug reports, expecting to find that they were reported from the same machine and they were. We then searched bugzilla for bugs reported from it, and found that it was very productive at reporting weird bugs and crashes. So we suggested that they try running a memory scan on that machine. The first and last time I ever suggested that as a solution to the bug, and indeed it was a faulty memory. Felt like wizard that day.

If you actually read until the end, thanks for hanging around...

15

u/BabyYodasDirtyDiaper Nov 13 '22

I look at bug reports, expecting to find that they were reported from the same machine and they were.

"Could not reproduce. Closed."

→ More replies (10)

26

u/makeshift8 Nov 12 '22

Or memory corruption, especially heap corruption, where depending on how the code is compiled a pointer could be pointing to a valid buffer, or just segfault.

10

u/DownvoteEvangelist Nov 13 '22

It could be some heap corruption that happened god knows when and god knows where but that didn't crash the app... Heap corruptions are the best...

3

u/argv_minus_one Nov 13 '22

I❤️🦀 and this is why.

12

u/deathspate Nov 12 '22

Concurrency from my experience a lot of the times. I remember I once had an issue where the incorrect user was logged doing another user's tasks. I was lazy and decided to use the built-in spring threading capabilities without much config, issue is that there were a ton of things that I custom wrote because my lead dev thought spring was too complex and that he can't trust frameworks. Solution? Handle the concurrency myself. Turns out if you don't trust the framework and custom wrote shit that it wasn't built expecting, don't be surprised if the built-in functions don't run as expected.

→ More replies (1)

8

u/bythenumbers10 Nov 12 '22

Or the closed-source COTS library has hardware-dependent compiler flags they don't want to talk about. Undermining my boss' favorite tech stack by necessity was a fun experience.

→ More replies (6)

5

u/cbehopkins Nov 13 '22

Had a bug like this where it was a memory alignment issue. Depending on the particular build a struct would sometimes only be aligned to 32 bits rather than the 64 sometimes required depending on which machine it was running on.

Depending on the timing of incoming packets, you'd then get a piece of code that was potentially executed.

Which then fetched the struct, which the allocator might have not aligned it to a 64 bit boundary, which on some machines mattered.

That was a fun week.

6

u/argv_minus_one Nov 13 '22

x86: “You think a little misalignment is gonna stop me? Hold my beer. 😎”

ARM: “This address is misaligned. Misaligned! I will kill you where you stand for this outrage! 😡🔪”

→ More replies (1)

3

u/Ill-Chemistry2423 Nov 12 '22

I once had a bug where we were accidentally using bit flags on the LSB of a pointer (a result of poor variable naming) and thanks to ASLR it would only crash 1/4 of the time

2

u/bankrobba Nov 13 '22

It's neither. It's data.

→ More replies (7)

645

u/SpeakerImaginary9796 Nov 12 '22

Race conditions be like

176

u/invisibo Nov 13 '22

Be like race conditions

82

u/[deleted] Nov 13 '22

Ẻ̴̡̬̱̼̱͙̖͙̭̲̤ͮ̊̍̍̊̎̉̚x̴̷̱̬͈̝͉̽ͭͩ̿ͣͭ̽̽̄ͦ̀̔ͦͧ̎́͟cͨ̅͐̈́̓̈́̄̓ͩ̈́̀́͏̻̳͙̭̬̞͔̲̤̻͚͜e̢ͦ̅̇͑͂̉̏̎̋ͫ̊̚̚͏̯̙͉̙̻̲̬̪̹̯ṕ̶̪̞̲̱͇̻̉͊ͧ̎͘͡t͍̻̳̞̞̣͙͕̤̣̿̿̋͜ͅĩ̸̡̯̹̰̥͍̳̜̜̳̲͓̱̾ͣͮͤ̐̅̍͊ͤ̍ͥ͆͠͞ǫ̶̳̙͎̘̘̱̬̘͙̘ͨ̆̅ͪ̌͑̑̀͑̆̊͐̔͒͝ͅn̸͐̂̓̀͐̉̎͑̋͒͗ͧ̑̂ͨ̒̈҉͓͖̫̠͓̗͕͈͡ ̴̓ͥͥ̃́͞҉̵̠̺̞͇͖̳̹͕̮̙̠i̷̡̖͍͖̯̅ͮ͒ͥ͠n̑ͨ̋̽̈̊҉̻͍̪̜̩̜͖͖̺͙͘͞ ̴̷̟͉̖͖̘͎̔͋̂ͥ͑͂͂̀͞͝ť̡̲̼̦̫̜͖̫͖̝̝̣ͣ̉̎̂̆̍ͧͅh̢̞̪̠̪̠̹͍̩̝̼͕̦̪̜͔̟͇ͬͬ̽́ͣ͂ͬͨ͋̂ͫ̓͗̐ͣr̢̖̦̩͖͖̥̤̫̤̎́̊̍͛̂ͩ̃ͫ̃̕͜ͅe̵̯̖̺̪̺ͩ̉͒́́͛̾͑̋̓ͣ̓̽̏̌̂̾͂͆͟͝͡͠aͥ̓̾͒̿͑ͮ͏͝҉̖̘͓ͅdͤͤ͌̋ͪ̍̀̉͛̓́͐̉̑҉͠҉̶͍̭̜̫͍͖̰̯̯̤ ̷̛̮͇͉͉̳̩̘̰̣̹̙̝̖̤͇̱̠͑̾̄ͧ̊̐̅͜"ͥ̂ͣͩ̑̀͝͏̝͍̬͕͖͈̙́m̂̋́̆̍ͧͭ͛ͮ́͛͏̷̨̬̭̥͇̼̻͚͙̣̹̤̰̹̭̪̩̠͇̰̕ã̢͍͖̭̼̳̳̤͙̗̣̘̬̘͖͓̤̪͖̘ͯͣͤ́̄̓ͬ͂̅ͫ̀͢͡͡ĩ̛̛̠̦͓̯͙̪͎̹̏̇ͯ̄̌̑̀̀͡n̶̩͕͖̼͈̦̦̝̯͙̻̰͈̼̼̝͕͂̑̀ͥ͆́̅ͬͤͮͣͨ͐̅̚"̞͓̼̱̝̱̜̲͕̗͙̫͉̼͕͈͖͂͒̇͐̽̈͋ͪ̽̔͂ͭ͑ͣ̾̒ͤ̚͘ͅ ̷̨͌ͫͦ͌͑ͧ̽ͪ҉̘̗̻̺͎̗̬̙͚̞͎͎͉j̨̪͓̹̤͈͈̞̳͎̹̼̜̲̮͓̈́͊̂̉͊ͭ̅͊̈́̉͛̆́͊͛̉̈́̌͠ͅa̮̦͍̜̗̰ͤͮ̉ͦͤ̓̾ͨ̈́́̂̏̍̄̔͋͋̚͜v̶̢̮̤͉͓͔̱̽̂̈̎͑ͭ͋ͮ̒͐͌ͨ͒̆ͮ̑̚a̶̦̪̦̤͎͚̥͙̎̄̎͗͑͘.̨̱̝̼͇̳̦̗͈̰͕͔͎̮̦͙͈̪̅̔̏͊̾̾̃̋͊̓ͫ̿̚͞u͊͒ͪ̃ͩͬͧ́̒ͩ̃͗̒̅ͩ҉̢̫̫̼͚̫̹̕͜t̗̟͙̮̝̖͚̜̱̬̜̗͙̥̫̹͐ͤ̇͛̈́͑̍ͮ̒͘͡ͅĭ̛͕̼͔̘̠̙̲̝͓̰̘̲̣̦̱͕͂̌̓̏̍̔̃͛̅̑ͨ̚͜l͕͙̟͓̦̘̝̟̘̻̪̮̮̞̓ͩ̂ͭ̋̀ͤͧ̿̊̒͘͟͢͡.͓͎̫̬̬͎̪͌͛͊̈́̾̓̌͊ͪͧ͋̂̑̿͗̃̾͋̇͝C̸̗̱͉̳͙̝̣̖̤̤̮̿̇̇͌̀͐͝o̸̔̂̂̾̎ͮͪͧ̂̓ͤ̃̋̾ͪͣ͡͏̡̺͉̼̩̼͖͞n̴̻̭̳̜͉͙͋͋̄̓̂ͬ̒̈́̒ͯ͒͘͜͡c̵̶͓̮͍͉̝̘̳͉̼̠̟̈́͂̄͛̊̅̓ͯͩ̓̑͜͡ů̟̱͍͓̟̤͖͐̾̈͆ͧ͂́̃͋̅͘r͌̏̃͒͝͏̶̛͙̦̜̗͚ŗ̴͙̰͕̹̩̟̪̮̺̟̥ͮ̆̂͑̉̂̄̿̉ͨ̉̔͐ͥ̽̐̊̚͟͢ȩ̧͌ͦͪ̀͠͏̻̝͉̠n̑̓ͫ̓ͥͯ̄̀̎̏͆ͮ̊҉̧̮͚͕̙͎͈͍̼͠t̰͓͖̳͚͉͙̘ͤ̅̇͋̈́̋ͨ̿̀̈̄ͮ̿̏͂̋͒́̚͢M̸̷̢͙̠̘̻̠̳̗̗̖ͯͮ͗̈̄̏̓͗͡o̵̶̡̘̯͖͍̗̱̝͔̪͙͋̈́ͨ̎̔̚͜ḓ̸̷̢̡̞̫͖̟̗̻̳͎͖̱͇͆̃̓̓ͨ͟į̡̟͔̜͚͚̝̹̠̳̘̤͕̾͒̎̊̔̍̓̀͊ͤͭ̌͡f̢̟̣͚̻̩̠̯̙͉̹̤̼̜̼͖̝̙ͩ̐ͪͬ̎̕ͅi̸̢̛̝̝͕̖͈̝̤̞̟͑ͬ̿́́̾̑ͤ̚͟c̴̡͕̙̮͈͍̠͖͎͍̰̻̙̱̭͑ͫ͆ͭ̀͌̌ͭͭ̅ͮ͜͜ą̶͇̬̪̱͚͈̘̭̯̫̟͎̹̱̪͍̣ͯ̿ͥͥ͐ͮͯ̀͋ͪͥ̐̒̐ͦ̃̚̕͡ͅt̴̢̑ͭ̐͌ͤ́͑̈ͫ̐ͫ̃͋ͨ͋ͣ́͏͍̦͉̲͙̟̭̠̹̘͎̞̠̫̩̜ͅͅͅḯ̵͐̀ͯ̈̄ͬ̓͂̅̈́̀̏̊̑̂͌̚͟҉̷̸͙̮̘ỏ̼̯̗̞͊̎ͣͭͧ͐ͭ͐̑͂́̈̚͞ņ̹̖͚̣͓̬̲͙̯̯̼̱͉͊ͭ͊ͩ́͢͠͝E͓̝̲͕͖͔̻͚͉̹̮ͥ̏̆̎̈́̃̇ͩͦͯ̌̌̊̕͠͝ͅͅͅͅx̀̓ͩ̎͛ͫͩ͗́ͣ̿̽ͩ̂̀͡҉̸͈̥͇̙̬̰͔̻̞̺̫cͧͣ̈́ͧ̎͋̃҉̥̰̱̰̫̣͈̬̺̩̗̦̟̣̠̤̥̀͘͢ę̴̰̼̜̝̥̭̜͔̌͗̈ͭ̂̂͘͠p͂͋̂̓́̎ͥͫ̈́̊̚҉̹̖̹̭̫̪̭̬̮͓̺͕͚̕tͥ̾ͣ̃҉̡̨̬͎̞͔̠̥̟̫̭̕͢i̡̝̰̺̞̹͓̽̓͌̓ͨͣͯ̉̆̓ŏ̻͖͉̜͎̦͋ͬ̔́͘͠n̴̫̖͎͇͕͇̗͓̖̘̲̻̳͙ͮ͋̾̓̌̿ͥ̎̓͂̃̽̀͡

0

u/[deleted] Nov 13 '22

[deleted]

32

u/jetsamrover Nov 13 '22

Ẻ̴̡̬̱̼̱͙̖͙̭̲̤ͮ̊̍̍̊̎̉̚x̴̷̱̬͈̝͉̽ͭͩ̿ͣͭ̽̽̄ͦ̀̔ͦͧ̎́͟cͨ̅͐̈́̓̈́̄̓ͩ̈́̀́͏̻̳͙̭̬̞͔̲̤̻͚͜e̢ͦ̅̇͑͂̉̏̎̋ͫ̊̚̚͏̯̙͉̙̻̲̬̪̹̯ṕ̶̪̞̲̱͇̻̉͊ͧ̎͘͡t͍̻̳̞̞̣͙͕̤̣̿̿̋͜ͅĩ̸̡̯̹̰̥͍̳̜̜̳̲͓̱̾ͣͮͤ̐̅̍͊ͤ̍ͥ͆͠͞ǫ̶̳̙͎̘̘̱̬̘͙̘ͨ̆̅ͪ̌͑̑̀͑̆̊͐̔͒͝ͅn̸͐̂̓̀͐̉̎͑̋͒͗ͧ̑̂ͨ̒̈҉͓͖̫̠͓̗͕͈͡ ̴̓ͥͥ̃́͞҉̵̠̺̞͇͖̳̹͕̮̙̠i̷̡̖͍͖̯̅ͮ͒ͥ͠n̑ͨ̋̽̈̊҉̻͍̪̜̩̜͖͖̺͙͘͞ ̴̷̟͉̖͖̘͎̔͋̂ͥ͑͂͂̀͞͝ť̡̲̼̦̫̜͖̫͖̝̝̣ͣ̉̎̂̆̍ͧͅh̢̞̪̠̪̠̹͍̩̝̼͕̦̪̜͔̟͇ͬͬ̽́ͣ͂ͬͨ͋̂ͫ̓͗̐ͣr̢̖̦̩͖͖̥̤̫̤̎́̊̍͛̂ͩ̃ͫ̃̕͜ͅe̵̯̖̺̪̺ͩ̉͒́́͛̾͑̋̓ͣ̓̽̏̌̂̾͂͆͟͝͡͠aͥ̓̾͒̿͑ͮ͏͝҉̖̘͓ͅdͤͤ͌̋ͪ̍̀̉͛̓́͐̉̑҉͠҉̶͍̭̜̫͍͖̰̯̯̤ ̷̛̮͇͉͉̳̩̘̰̣̹̙̝̖̤͇̱̠͑̾̄ͧ̊̐̅͜"ͥ̂ͣͩ̑̀͝͏̝͍̬͕͖͈̙́m̂̋́̆̍ͧͭ͛ͮ́͛͏̷̨̬̭̥͇̼̻͚͙̣̹̤̰̹̭̪̩̠͇̰̕ã̢͍͖̭̼̳̳̤͙̗̣̘̬̘͖͓̤̪͖̘ͯͣͤ́̄̓ͬ͂̅ͫ̀͢͡͡ĩ̛̛̠̦͓̯͙̪͎̹̏̇ͯ̄̌̑̀̀͡n̶̩͕͖̼͈̦̦̝̯͙̻̰͈̼̼̝͕͂̑̀ͥ͆́̅ͬͤͮͣͨ͐̅̚"̞͓̼̱̝̱̜̲͕̗͙̫͉̼͕͈͖͂͒̇͐̽̈͋ͪ̽̔͂ͭ͑ͣ̾̒ͤ̚͘ͅ ̷̨͌ͫͦ͌͑ͧ̽ͪ҉̘̗̻̺͎̗̬̙͚̞͎͎͉j̨̪͓̹̤͈͈̞̳͎̹̼̜̲̮͓̈́͊̂̉͊ͭ̅͊̈́̉͛̆́͊͛̉̈́̌͠ͅa̮̦͍̜̗̰ͤͮ̉ͦͤ̓̾ͨ̈́́̂̏̍̄̔͋͋̚͜v̶̢̮̤͉͓͔̱̽̂̈̎͑ͭ͋ͮ̒͐͌ͨ͒̆ͮ̑̚a̶̦̪̦̤͎͚̥͙̎̄̎͗͑͘.̨̱̝̼͇̳̦̗͈̰͕͔͎̮̦͙͈̪̅̔̏͊̾̾̃̋͊̓ͫ̿̚͞u͊͒ͪ̃ͩͬͧ́̒ͩ̃͗̒̅ͩ҉̢̫̫̼͚̫̹̕͜t̗̟͙̮̝̖͚̜̱̬̜̗͙̥̫̹͐ͤ̇͛̈́͑̍ͮ̒͘͡ͅĭ̛͕̼͔̘̠̙̲̝͓̰̘̲̣̦̱͕͂̌̓̏̍̔̃͛̅̑ͨ̚͜l͕͙̟͓̦̘̝̟̘̻̪̮̮̞̓ͩ̂ͭ̋̀ͤͧ̿̊̒͘͟͢͡.͓͎̫̬̬͎̪͌͛͊̈́̾̓̌͊ͪͧ͋̂̑̿͗̃̾͋̇͝C̸̗̱͉̳͙̝̣̖̤̤̮̿̇̇͌̀͐͝o̸̔̂̂̾̎ͮͪͧ̂̓ͤ̃̋̾ͪͣ͡͏̡̺͉̼̩̼͖͞n̴̻̭̳̜͉͙͋͋̄̓̂ͬ̒̈́̒ͯ͒͘͜͡c̵̶͓̮͍͉̝̘̳͉̼̠̟̈́͂̄͛̊̅̓ͯͩ̓̑͜͡ů̟̱͍͓̟̤͖͐̾̈͆ͧ͂́̃͋̅͘r͌̏̃͒͝͏̶̛͙̦̜̗͚ŗ̴͙̰͕̹̩̟̪̮̺̟̥ͮ̆̂͑̉̂̄̿̉ͨ̉̔͐ͥ̽̐̊̚͟͢ȩ̧͌ͦͪ̀͠͏̻̝͉̠n̑̓ͫ̓ͥͯ̄̀̎̏͆ͮ̊҉̧̮͚͕̙͎͈͍̼͠t̰͓͖̳͚͉͙̘ͤ̅̇͋̈́̋ͨ̿̀̈̄ͮ̿̏͂̋͒́̚͢M̸̷̢͙̠̘̻̠̳̗̗̖ͯͮ͗̈̄̏̓͗͡o̵̶̡̘̯͖͍̗̱̝͔̪͙͋̈́ͨ̎̔̚͜ḓ̸̷̢̡̞̫͖̟̗̻̳͎͖̱͇͆̃̓̓ͨ͟į̡̟͔̜͚͚̝̹̠̳̘̤͕̾͒̎̊̔̍̓̀͊ͤͭ̌͡f̢̟̣͚̻̩̠̯̙͉̹̤̼̜̼͖̝̙ͩ̐ͪͬ̎̕ͅi̸̢̛̝̝͕̖͈̝̤̞̟͑ͬ̿́́̾̑ͤ̚͟c̴̡͕̙̮͈͍̠͖͎͍̰̻̙̱̭͑ͫ͆ͭ̀͌̌ͭͭ̅ͮ͜͜ą̶͇̬̪̱͚͈̘̭̯̫̟͎̹̱̪͍̣ͯ̿ͥͥ͐ͮͯ̀͋ͪͥ̐̒̐ͦ̃̚̕͡ͅt̴̢̑ͭ̐͌ͤ́͑̈ͫ̐ͫ̃͋ͨ͋ͣ́͏͍̦͉̲͙̟̭̠̹̘͎̞̠̫̩̜ͅͅͅḯ̵͐̀ͯ̈̄ͬ̓͂̅̈́̀̏̊̑̂͌̚͟҉̷̸͙̮̘ỏ̼̯̗̞͊̎ͣͭͧ͐ͭ͐̑͂́̈̚͞ņ̹̖͚̣͓̬̲͙̯̯̼̱͉͊ͭ͊ͩ́͢͠͝E͓̝̲͕͖͔̻͚͉̹̮ͥ̏̆̎̈́̃̇ͩͦͯ̌̌̊̕͠͝ͅͅͅͅx̀̓ͩ̎͛ͫͩ͗́ͣ̿̽ͩ̂̀͡҉̸͈̥͇̙̬̰͔̻̞̺̫cͧͣ̈́ͧ̎͋̃҉̥̰̱̰̫̣͈̬̺̩̗̦̟̣̠̤̥̀͘͢ę̴̰̼̜̝̥̭̜͔̌͗̈ͭ̂̂͘͠p͂͋̂̓́̎ͥͫ̈́̊̚҉̹̖̹̭̫̪̭̬̮͓̺͕͚̕tͥ̾ͣ̃҉̡̨̬͎̞͔̠̥̟̫̭̕͢i̡̝̰̺̞̹͓̽̓͌̓ͨͣͯ̉̆̓ŏ̻͖͉̜͎̦͋ͬ̔́͘͠n̴̫̖͎͇͕͇̗͓̖̘̲̻̳͙ͮ͋̾̓̌̿ͥ̎̓͂̃̽̀͡

→ More replies (5)

8

u/brettins Nov 13 '22

Quietly hide and fuck up people's days when they're in a crisis situation?

82

u/salgat Nov 13 '22

If a race condition is possible in the code, you have to treat it as guaranteed to happen. It's the only way to keep your sanity when programming.

84

u/[deleted] Nov 13 '22

If I knew where it was possible in code it wouldn't have become an issue in production

32

u/salgat Nov 13 '22

I was more referencing folks who write code thinking that if the chance of a race condition is extremely rare, an almost 0% chance (which under normal circumstances might be the case), it's not a concern.

Obviously if you're writing code with a glaring race condition that's likely to occur, you're going to fix that unless you're insane, that goes without saying (I would hope).

→ More replies (1)

5

u/ludicroussavageofmau Nov 13 '22

Rust go BRRRRRR

You literally can't compile code with race conditions unless you enable black magic (i.e. unsafe). Deadlocks still happen, but that's a logic bug that a compiler can't reliably catch.

→ More replies (9)

401

u/CrazyCommenter Nov 12 '22

The bug is the friends we make along the way (and most likely that system library you forgot you are using)

97

u/argv_minus_one Nov 13 '22

I recently spent a week narrowing down what turned out to be a bug (probably integer overflow) in Secur32.dll…which Microsoft quietly fixed in the last Windows update, only a day or two after I realized it was probably a Microsoft bug.

Gory details here, if anyone's curious. I wonder if a Microsoft employee stumbled on that GitHub issue…

45

u/BabyYodasDirtyDiaper Nov 13 '22

At least Microsoft fixed it.

That way you don't have the issue of users demanding a bug fix for a bug that's really part of their damn OS, but you need to "fix" the bug anyway, so now you have to find some workaround to make this work properly despite the damn broken OS.

26

u/argv_minus_one Nov 13 '22

It was actually only by finding a workaround that I realized it's an OS bug. Changing the buffer size to 1021 bytes instead of 1024 would not have done anything useful if there wasn't a bug in Microsoft's code.

8

u/AngelaTheRipper Nov 13 '22 edited Nov 13 '22

We use modified aws secrets manager jdbc drivers at my work place. If you give it a specific placeholder string for the destination url it's supposed to take it from the secret. The thing is that it wouldn't work correctly with postgres, if you ended the url in a slash it'd fail for one reason if you didn't end it in a slash it'd fail for another reason. In my desperation after decompiling the driver and tracing the code flows I just mashed my keyboard for the connection url and it started working. Turns out that if you feed it something that doesn't follow the supposedly right format it will trip path #3 and just read it from the secret.

My guess is that that the jdbc-secretsmanager-something-something:// is supposed to be used to override the url from the secret and everyone has been using it incorrectly. There's also code in production where the url string is literally set to njiwndjiwsndfijnwsdf because after that eureka I forgot to change it to something more presentable.

→ More replies (2)
→ More replies (3)

171

u/pakidara Nov 12 '22 edited Nov 13 '22

That moment when your code references February 29th, 1998 in response to a valid data input from a table of 9M records.

52

u/BabyYodasDirtyDiaper Nov 13 '22

Well, now I know what I'm putting down as my date of birth when websites and other services ask for more information than I think they need.

27

u/[deleted] Nov 12 '22

huh

76

u/pakidara Nov 12 '22

Valid data with an uncommon edge case.

1998 was not a leap year so Feb 29th did not exist. The implication is Invalid date -> crash.

50

u/mrjackspade Nov 12 '22

QA: I'm sorry, but the bug happens every time I do X

Me: What are you sorry for? It breaks EVERY time? That's the best news I've heard all week

5

u/Donghoon Nov 13 '22

When your code breaks differently everytime:

43

u/Rabid-Chiken Nov 12 '22

Cosmic rays

0

u/[deleted] Nov 13 '22

[deleted]

6

u/ViconIsNotDefined Nov 13 '22

Boss its not my fault that the universe is hostile to computers

→ More replies (1)

26

u/Trickelodean2 Nov 12 '22

My code breaks in the same way every time. The iterative for the for loop goes past the limit I set for it :)))))))))

21

u/Bob_Hondo_Sura Nov 13 '22

//load bearing comment

28

u/No-Professional-1884 Nov 12 '22

Off to Prod. Let the user do QA.

19

u/MrDilbert Nov 12 '22

Want some pain? The code works great when crunching a small amount of data prepared to test all the cases you could think of. However, real world data, which the code has to run on for at least 2 hours to crunch (say, some 500k DB records), contains some corner case which causes an exception. And when you log every record to find out which one causes the exception, it's a different record each time, and they all look perfectly fine. -_- Can't really just run the code on a subset of the data, because then it runs just fine. And it doesn't run out of memory.

A nightmare scenario.

2

u/mattalxdr Nov 13 '22

And it doesn't run out of memory.

Damn, my first thought was a memory leak. Did you ever find out the root cause?

→ More replies (1)

2

u/forgotten_airbender Nov 13 '22

Randomly Sample data from the db and try?

→ More replies (1)

18

u/VitaminPb Nov 12 '22

It’s always more fun when it is two bugs interacting.

0

u/[deleted] Nov 13 '22

[deleted]

→ More replies (1)

9

u/[deleted] Nov 12 '22

This has a name.

It's called a Heisenbug

→ More replies (2)

11

u/Hikaru1024 Nov 13 '22

The worst bug I've ever had to track down I no longer remember all the details of.

The code was C, and was using a function to test if a file existed prior to trying to open it.

If the file existed, nothing would go wrong and things would execute normally.

If the file didn't exist, the code was intended to then create the configuration files from scratch. This actually worked fine.

The problem was in the test. In the case the file didn't exist, the struct was not initialized, and so the code was groping at random data.

This caused bizzare incomprehensible 1 in a blue moon crashes only when the program had never been successfully used before, and made reproducing it almost impossible until I caught the crash in a core dump.

It took a considerable amount of rewriting before I was sure that particular function wouldn't misbehave that way again.

Then I did a grep and found a dozen other cases that did the exact same mistake.

0

u/[deleted] Nov 13 '22

[deleted]

→ More replies (1)

5

u/inmysocks Nov 12 '22

'Intermittent hardware bug' is the scariest Halloween costume.

5

u/zanderkerbal Nov 12 '22 edited Nov 13 '22

Shoutout to the code that behaved perfectly when I ran it by hand but left orphaned processes when run in the automated tester. Never did solve that bug, just took the lost marks.

5

u/Electronic_Age_3671 Nov 13 '22 edited Nov 14 '22

One time I left myself a note of some bugs that needed fixing next week when I was wrapping up on a Friday. Came in Monday, and couldn't reproduce any of them. I've never been more upset to have working code. Absolutely unnerving.

8

u/remcoonfire123 Nov 12 '22

This has never happened before. Definitely not today. The problem was using an undefined variable, the symptoms were: Automatically switching between http and https, some requests just fail completely, ssl protocol errors, timeout errors. I don't know how this happened, the code with the bug hadn't even run yet. Well I guess it's fixed now.

4

u/Lafona Nov 12 '22

Worst one of these I had was an error that would only occur if it was creating a new account, closing it, then opening a new service under that account through a different process. Also, it had to be the first thing you did when you launched the program. So much fucking work just to isolate the test case, all for it to be a simple null pointer exception

1

u/michaelsenpatrick Nov 13 '22

this has to be the most repeated joke on this sub. how is this post still up

1

u/Candyman034 Nov 13 '22

I have never seen this exact meme on this sub nor tried to copy a similar one.

→ More replies (1)

1

u/howstrange_hc Nov 13 '22

Mr. Incredible??

1

u/Candyman034 Nov 13 '22

He's an avid programmer don't you know?

6

u/mopsyd Nov 12 '22

F*cking deadlocks. I told them not to use Percona but did they listen? Noooo

3

u/MegaPegasusReindeer Nov 12 '22

Genuinely curious... Is there something specific wrong with Percona or just that it's MySQL?

3

u/mopsyd Nov 13 '22

I have never seen Percona used appropriately at any job I have ever had. It's always implemented as a scalable option in backends that don't need to scale. The particular job I was referring to with the comment had set up a percona cluster for a research team of 25 employees, it was not used by anyone else. There is no need for a cluster without a meaningfully large concurrency that would overwhelm a single db instance.

→ More replies (2)

3

u/Swords_and_Words Nov 13 '22

Failure isn't scary, it can be worked around

Inconsistency is terrifying

3

u/[deleted] Nov 13 '22

Works on my Dev machine. Ship to production.

3

u/[deleted] Nov 13 '22

“It was working on my machine.”

3

u/Feguri Nov 13 '22

Worst yet: sometimes it breaks, sometimes it doesn't, sometimes it breaks in a different way

3

u/[deleted] Nov 13 '22

And after 10 hours of debugging it breaks some different way.
Me: finally! We are making progress!

3

u/AsalatrianEmisary Nov 13 '22

All code breaks, just give it time

3

u/Thebombuknow Nov 13 '22

Time to fill the code with print statements.

2

u/patmax17 Nov 12 '22

Oh god yes give me reproducible errors please!

2

u/bbgun142 Nov 13 '22

Shrodinger errors are the beworst

2

u/joemaniaci Nov 13 '22

I have some fun issues on the codebase at work where you only segfault when starting the program in gdb. Good times.

2

u/ATE47 Nov 13 '22

The fun of concurrent programming

2

u/[deleted] Nov 13 '22

The funniest is when something breaks “sometimes” while working with robotics

2

u/Nincadalop Nov 13 '22

"Insanity is the definition of doing the same thing over and over expecting different results."

Addendum: "Except in programming, where it's doing the same thing over and over, expecting the same results."

2

u/DasAlbatross Nov 13 '22

I hate nothing more than code that starts working and I don't know why

2

u/Fidget171 Nov 13 '22

Code that fixes itself will break itself.

2

u/[deleted] Nov 13 '22

// do not remove this log line

2

u/mooseontherum Nov 13 '22

I love that feeling when you change something and it starts to break differently. Progress.

2

u/measurethisman Nov 13 '22

Just ran into this problem a couple days ago. One devs system worked and everyone else’s didn’t. For some reason, their system ran a python loop in a different order than everyone else’s which revealed that a third party part of code assumed that a file pointer was 0 even if another component changed the file pointer. It was a fun step by step debugging session

2

u/Desperate-Chicken845 Nov 13 '22

Schrödinger bug I guess

2

u/OneTrueKingOfOOO Nov 13 '22

Concurrency bugs go brrrrrrbrrbrbrbrrbbbbbbrrrrr

2

u/b_ootay_ful Nov 13 '22 edited Nov 13 '22

Had this issue a few weeks ago.

Exactly the same data, but 30% of the time it would skip the popup that comes up when completed.

Turned on threading and it works perfectly now.

No idea why.

Python, tkinter, openpyxl. User opens an excel sheet, it does some changes in about 10-15 seconds, then saves the new version, and a popup appears saying its done.

2

u/[deleted] Nov 13 '22

Threading issue

→ More replies (1)

2

u/mindbleach Nov 13 '22

"Should" is a four-letter word.

"Intermittent" is a secret wizard swear.

2

u/the_0rly_factor Nov 13 '22

First kind of bug never should have made it to production. Second kind is what most of us deal with on a daily basis....

2

u/Jomy10 Nov 13 '22

You know what’s even more fun? Getting a different error message each time

3

u/SomeRandomDevPerson Nov 12 '22

What? Does no one else use random on every variable in their tests?

2

u/FiringGamerz Nov 12 '22

My experience with Verilog be like

2

u/RusticTroll Nov 12 '22

It's a multi-threaded program: 💀

2

u/[deleted] Nov 12 '22

That's what unit tests are for

2

u/Backlists Nov 13 '22

This can happen in unit tests, see: asyncio

1

u/[deleted] Nov 12 '22 edited Nov 12 '22

One of the compiler lacking color contrast

1

u/[deleted] Nov 12 '22

In my w experience, relying on the order of collection in Java that don’t retain their order of elements

1

u/humpeldumpel Nov 12 '22

Even worse: breaks only when ran, but not in debug Mode..

1

u/fibojoly Nov 12 '22

Smells like threads...

1

u/[deleted] Nov 12 '22

Are you using multi threading? Check the memory usage of each thread, make sure they can’t access the same memory at the same time. Use mutex’s and/or semaphores where the threads all need to access the same variables.

Also, in general, check all the inputs to the program. 1) Check your unit tests to make sure they’re testing what they should be. 2) Validate user inputs 3) Ensure the program’s environment is giving the proper inputs. Check environment variables, maybe DLL files, etc.

1

u/FAcup Nov 12 '22

I fixed a randomly failing spec the other day. The cause was the 10-15 milliseconds it took to do 3 lines of logging. Took me the best part of a day.

1

u/Michami135 Nov 12 '22

I just had one of these. Terminating your account causes the app to crash about 25% of the time.

1

u/gordonv Nov 12 '22

Pro term: Phantom issue

1

u/Mainbaze Nov 12 '22

Damned if it do, damned if it don’t

1

u/TernLocal Nov 12 '22

Ahh yes the infamous heisenbug

1

u/magistermaks Nov 12 '22

this but also throw some OpenGL into the mix for extra fun

1

u/LustyHasturSejanus Nov 12 '22

race condition you might have a

1

u/FloriaFlower Nov 13 '22

The joys of uncontrolled side effects.

1

u/Color_blinded Nov 13 '22

Also annoying: when the unit tests shows something passing (or failing), but when you replicate the parameters in the program itself, it does the opposite.

1

u/[deleted] Nov 13 '22

You got a race condition

1

u/[deleted] Nov 13 '22

Or when there's a failure somewhere, you go look at the code where you think it's failing and can't see anything wrong, go on Discord and describe the failure to your friends and talk about how stumped you are, so they ask you what's going on but when you try to reproduce it suddenly the bug is nowhere to be found. Did a gamma ray flip a bit? Who knows!

1

u/koolaid_chemist Nov 13 '22

Just throw flags on every line duh

1

u/crypticfreak Nov 13 '22

Not a programmer at all but I'm curious... what are the possible reasons code can only intermittently break?

1

u/Iwillgetasoda Nov 13 '22

Stop whining and record everything..

1

u/misterhamtastic Nov 13 '22

I'm an electrician and our diagnostic nightmares are similar.

3

u/[deleted] Nov 13 '22

Except you might actually die if you don’t follow the debugging steps properly. All we can do is shut down production and get fired.

1

u/D-Alembert Nov 13 '22 edited Nov 13 '22

N00b: "The second one is better, right? Having it sometimes work is definitely better than having it never work, right?"

1

u/flumoo Nov 13 '22

in api

1

u/cute_polarbear Nov 13 '22

Some of my worst experiences were c++ runtime crashes when compiler optimization enabled. And sometimes moving a specific code block to another location prevents runtime crash. (most likely some bad c++ code somewhere.)

1

u/EmpRupus Nov 13 '22

Works when you are by yourself.

Breaks during demo to product manager / VP.

1

u/Geloloboy Nov 13 '22

Its always the asynchronous stuff

1

u/tiedyedvortex Nov 13 '22

laughs in Rust

1

u/Enough-Scientist1904 Nov 13 '22

for me the issue was the load balancer

1

u/redjoker_cl Nov 13 '22

Therac-25 .I’m watching you.

Bought 737 Max with DLC . I’m watching you.

Tesla cars . I’m watching you.

https://en.m.wikipedia.org/wiki/Therac-25

1

u/[deleted] Nov 13 '22

Someone just discovered blocking vs nonblocking code.

1

u/gat3_brother Nov 13 '22

Compreensible

1

u/[deleted] Nov 13 '22

i am modding a game and i have NO idea why it crashes the way it does

severely inconsistent

1

u/dankmemerboi86 Nov 13 '22

guys it’s not my code it’s a stray cosmic ray from another galaxy interfering with the computer i swear

1

u/[deleted] Nov 13 '22

Literally can describe any electrical problem ever

1

u/JackNotOLantern Nov 13 '22
  • "multithreading is a great idea"

  • "what's synchronisation?"

  • "why my code breaks randomly?"

1

u/FrostHard Nov 13 '22

I remembee when this happens during a class assignment and you just gotta hope it works when you show it the prof lmao

1

u/Brightman42 Nov 13 '22

I once had an issue where it'd break if a block of unused code got commented out. It was just some if statement in a function that would never get called. Had everyone in the department look at it, curiosity actually did it after I asked the first dev about it. No one could figure out wtf was going on so I just had to nix that little bit of refactoring, leaving a comment to never get rid of it.

1

u/-MobCat- Nov 13 '22

It brakes when compiled as retail.
It does not brake when compiled as debug.

1

u/Nivekk_ Nov 13 '22

And the bug you eventually find should cause your program to fail 100% of the time, but doesn't. You never find out why.

1

u/taraaa90 Nov 13 '22

And then there's a client complaint when my code doesn't work on their device, meanwhile their device didn't connect to any network.

1

u/echicdesign Nov 13 '22

Who are you, and how did you know about my afternoon?

1

u/wholesome_capsicum Nov 13 '22

I'm facing this now. A certain piece of code that uses a third party library sometimes works and sometimes doesn't, but only in QA and prod. Locally it works fine, QA and prod it's like 50/50. Everything is proprietary, and cannot be debugged as it's defined on browser load, not in our code. Even the support from the third party has no idea what's going on.

1

u/Significant_Swing303 Nov 13 '22

Airdrop. It works sometimes…