Bug Fixing
Bug Fixing
Bug Fixing
That's step zero: rule out black magic
Yeah, but sometimes it works.
It's even worse then: that means it's probably a race condition and do you really want to run the risk of having it randomly fail in Production or during an important presentation? Also race conditions generally are way harder to figure out and fix that the more "reliable" kind of bug.
Or it was an issue with code generation, or something in the environment changed.
Mmm, race conditions, just like mama used to make.
Good luck figuring out why it sometimes doesn't work 🙃
There was that kind of bug in Linux and a person restarted it idk how much (iirc around 2k times) just to debug it.
This is 100% valid when dealing with code generation sometimes and I hate it
We call this sort of test "fuzzy". If it's really bad they call it by my own personal identifier of "unstable".
Legit happens without a race condition if you’ve improperly linked libraries that need to be built in a specific order. I’ve seen more than one solution that needed to be run multiple times, or built project by project, in order to work.
Isn't that the definition of a race condition, though? In this case, the builds are racing and your success is tied to the builds happening to happen at the right times.
Or do you mean "builds 1 and 2 kick off at the same time, but build 1 fails unless build 2 is done. If you run it twice, build 2 does "no change" and you're fine"?
Then that's legit.
The first is a surprise; the second is testing.
i sometimes do that so i can inspect the error messages on a cleared terminal
Sometimes I forget what I was looking for and have to restart the mental loop when doing this.
One of my old programs produces a broken build unless you then compile it again.
Some code has bugs.
Some code has ghosts.
Just had that happen to me today. Setup logging statements and reran the job, and it ran successfully.
I've had that happen, the logging statements stopped a race condition. After I removed them it came back...
Thank you for playing Wing Commander!
======== 37/37 tests passing ========
That's when the real debug session begins
Great time to find out your tests are useless!
They’re not completely useless. They’re conditionally useless, and we don’t know the condition yet.
So how do you write a good test? It's like you have to account for unknown unknowns, and I don't really have a good theory for doing that.
Right now, I usually end up writing tests after the code is broken, and most of them pass because they make the same mistakes as my original code.
The crazy thing is that sometimes this just works...
If that doesn't work, sometimes your computer just needs a rest. Take the rest of the day off and try it again tomorrow.
I often do this, but I always hit Ctrl-S before running it again. Shamefully, this probably works about 10% of the time. Does that technically count as changing nothing?
That and a make clean can work wonders.
Autosave on focus loss dude.
Well, duh! You need to use the right incantations!
Something something motive force.
I actually did this earlier today
I've only recently joined the dev world and I saw this post in the morning. Late this afternoon I'm doing a deployment that fails, couldn't determine the cause as I'm a noob, before bothering a more senior dev for help I run it again... It worked.
Somehow higher than 0% success rate.
it's only dumb til it works
The definition of insanity is doing the same thing over and over and expecting different results.
Sponsored by QA gang. Gotta make sure it's a 5/5 issue and not just a frequent issue
My way: wrap it in a shell script and put a condition if exit status is not 0 then say "try clear the cache and run it again"
AKA - the test suites at half the companies I've worked. Except they use a loop with retries as well
"Works in my environment."
Einstein did say...
Ever work?
Disturbingly, yes
Every sufficiently complicated system is indistinguishable from being alive, and living beings need some warm-up time.
All the time. Causes include:
We call those "flaky tests" and only fail a build if a given test cannot pass after 2 retries. (We also flag the test runs for manual review)
I mean
maybe
Not with code, but i write a lot of LaTeX and that often starts working on second compilation
Well if it doesn't work once try again if it doesn't work twice or thrice maybe there's a problem. If it works it is resolved ... for now, least effort solution.
If that doesn’t work, restart it and then try.
I only do it because it works!
on xcode i would say it has a 50% chance of working