this post was submitted on 03 Sep 2024
852 points (99.4% liked)

Programmer Humor

32490 readers
553 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
(page 2) 16 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 2 months ago

I found the solution, we're running debug builds in prod from now on

[–] [email protected] 9 points 2 months ago (2 children)

Haha, heisenbugs, always a fun time.

More seriously, I’d be surprised if this wasn’t a classic race condition

load more comments (2 replies)
[–] [email protected] 13 points 2 months ago

For those of you who've never experienced the joy of PowerBuilder, this could often happen in their IDE due to debug mode actually altering the state of some variables.

More specifically, if you watched a variable or property then it would be initialised to a default value by the debugger if it didn't already exist, so any errors that were happening due to null values/references would just magically stop.

Another fun one that made debugging difficult, "local" scoping is shared between multiple instances of the same event. So if you had, say, a mouse move event that fired ten times as the cursor transited a row and in that event you set something like integer li_current_x = xpos the most recent assignment would quash the value of li_current_x in every instance of that event that was currently executing.

[–] [email protected] 17 points 2 months ago
[–] [email protected] 4 points 2 months ago

Someone has a compiler if statement left somewhere in their code (... probably)

[–] [email protected] 158 points 2 months ago (3 children)

Aren't those almost always race condition bugs? The debugger slows execution, so the bug won't appear when debugging.

[–] [email protected] 83 points 2 months ago (2 children)

Turned out that the bug ocurred randomly. The first tries I just had the "luck" that it only happened when the breakpoints were on.
Fixed it by now btw.

[–] [email protected] 17 points 2 months ago (1 children)

I had a bug like that today . A system showed 404, but about 50% of the time. Turns out I had two vhosts with the same name, and it hit them roughly evenly 😃

load more comments (1 replies)
[–] [email protected] 93 points 2 months ago (1 children)

bug ocurred randomly.

Fixed it by now btw.

someone's not sharing the actual root cause.

[–] [email protected] 60 points 2 months ago (1 children)

I'm new to Go and wanted to copy some text-data from a stream into the outputstream of the HTTP response. I was copying the data to and from a []byte with a single Read() and Write() call and expexted everything to be copied as the buffer is always the size of the while data. Turns out Read() sometimes fills the whole buffer and sometimes don't.
Now I'm using io.Copy().

[–] [email protected] 51 points 2 months ago (3 children)

Note that this isn't specific to Go. Reading from stream-like data, be it TCP connections, files or whatever always comes with the risk that not all data is present in the local buffer yet. The vast majority of read operations returns the number of bytes that could be read and you should call them in a loop. Same of write operations actually, if you're writing to a stream-like object as the write buffers may be smaller than what you're trying to write.

load more comments (3 replies)
[–] [email protected] 9 points 2 months ago (1 children)

sometimes it's also bugs caused by optimizations.

load more comments (1 replies)
load more comments (1 replies)
[–] [email protected] 76 points 2 months ago (1 children)

Perfect, now you just have to wrap your program inside a debugger in production!

[–] [email protected] 47 points 2 months ago* (last edited 2 months ago) (2 children)

We test AND develop in production. Get on my level.

[–] [email protected] 36 points 2 months ago (1 children)

One of our customers does that. It happened multiple times already that one dev fixed an issue in production, and the next regular deployment overwrote everything.

But fortunately, it's just critical infrastructure and nothing important.

[–] [email protected] 13 points 2 months ago

When I left my last job they were using the zip file method for version control and one creative developer managed to link two versions of libc at the same time.

Software is so useful that the standard for utility is extremely low.

load more comments (1 replies)
load more comments
view more: ‹ prev next ›