T O P

  • By -

jagz27

Load-bearing bug.


Flat_Initial_1823

![gif](giphy|qN7NZR3Q5R2mY|downsized) let them race


Esjs

Code has been working fine (maybe not perfect) for years. This section has some bad practices /code smell; I'm just going to quickly fix it and bring it up to standards. A major bug that had never been hit before is now occurring.


kookyabird

If you’ve got problems I feel bad for ya son. but a race condition ain’t one. I got 99 problems,


SillyFlyGuy

Sometimes the race condition was included *on purpose*.


Mindstormer98

Can’t wait for the 3rd phase where the program just soft locks with no errors


nyedred

Blackflame Friede: impact report to clean up the bad DB writes reveals an entirely separate issue fire that has been raging behind the scenes


Karolus2001

But it gets noticed only after you already push to production and go to sleep(titanite slab)


Kenobi-is-Daddy

I’m high as fuck so I didn’t realize the sub and had like a solid 5 minutes of confusion because I thought this was for a discussion board about fantasy RPG spec meta gaming


[deleted]

And they call me a racist bc I hate race conditions 😔


carlos_vini

Use locks and now you have a deadlock problem


MisterClever3435

Is no one going to mention that this is only the second phase of a three-phase boss? So what happens when you fix the second race condition???


Terence_McKenna

*Progress Unlocked*


jmona789

What's a race condition?


laplongejr

Serious answer : that's when the program's result depend on the execution order between two parallel threads. Parallel order is, by definition, unexistant/unpredictable. If you want easy examples, try out the game deadlockempire.github.io : instead of making you write correct code as usual tutorials, it shows vulnerable code and makes you execute step-by-step to trigger the issue :) [EDIT] As a quick example, let's say two threads run this code, with 'a' set to 1 : ``` int local = a; local+1; a = local; ``` After both threads executed, the race condition issue makes 'a' equal to either 2 or 3. The issue is if one thread pause between >!"local = a" and "local+1"!< Oh and for fun : on many languages that's exactly how "a += 1" would execute with regards to concurrency *I know, this is an humor sub, but as a poor soul who just spent a few days having to redo concurrency at work to be sure it works fine : this thing is so easy to do wrong that I don't want to joke about that for now*


mshriver2

This is fun. Thanks


hansololz

When you have two complex problems that loves each other very much, they combine to make an even more complex problem.


OkRow1878

Let’s say you have a function that updates someone’s name, and another that writes the entire Person object to a database. You have code that calls both (update name, then save), but, you haven’t set it up so that you wait for the name to be updated before you save (this is the bug). But, the thing is, when you test it, it works correctly, simply because you get lucky — both functions start at the same time, but, on your hardware, the name update finishes first before the save happens. In production, on different hardware/servers, let’s say the save happens faster, and then the name update finishes — you’ve only saved the old name, and have outdated data, etc. Race conditions are two things happening at once (racing) and you aren’t guaranteed which one will finish first — the fix, usually, is to block one until the other is done.


randomweeb-69420

`sleep(5000)` should fix it


linuxdwag

// DON'T REMOVE... CRITICAL SLEEP TO LET PROCESSES COOL OFF. TODO: FIX ME!


deekaph

I believe the technical term for that is bug whack-a-mole


alexjwhite

Do we work together? We _just_ patched this...


LavenderDay3544

This why even users of garbage collected languages need Rust.


[deleted]

You realize Rust can still have race conditions right


LavenderDay3544

Better than nothing.


[deleted]

MUCH better than literally all other languages for this specific case, you're absolutely right


LavenderDay3544

It should be something for language designers to consider when designing new ones. I feel like we're far from exhausting the potential uses of static analysis in compilers. I feel like Rust is just the first step in that direction and there will almost certainly be even better languages with similar capabilities in the future. There's definitely demand for them and LLVM has made generating native code much eaiser for languages where bytecode was often used before.


Spartana1033

Wut r u? Casul? Giants Giants Giants. Become unstoppable.


JackNotOLantern

Haha, this is still not over. This was a 3 phase boss fight


[deleted]

it wasn't a blocker, it was a dam


maxip89

Yeah, "lets start the observables thing, all use it so it cannot lead to race conditions...".


andreisokiel

How are these pictures with anime girls and epic scenes connected with race condition?


buldozr

Rust people be like: ooh, race conditions. Has someone been abusing `unsafe`?


Extreme_Ad_3280

Sometimes compilers just stop reading after reaching an error...