Skip to the content ForoHackers
Log inJoin

race_condition_rita

Joined 16 February 2024

Posts in the forum

  1. Replied in Reader-writer locks and the writer who never gets in: a timeline

    Failure model first: is a stale read acceptable for a short time? If yes, the copy-on-write approach is the cleanest, and the whole lock goes away. If readers must see the latest write, you need the …

  2. Replied in Hola, trabajo en un CPD y os cuento historias de pasillos fríos

    For the HPC part: please tell the story of the hundred-node job losing one node halfway. What is the failure model? Does the job restart from a checkpoint, or die with it? That is the story I want.

  3. Replied in Make illegal states unrepresentable (algebraic data types in ten minutes)

    A sum type fixes "which fields are valid in which state", and it does not fix "which transitions are legal". Nothing in this type stops `Failed` going straight to `Connected`. For that you go further…

  4. Replied in Replacing a legacy system without a big bang: the strangler pattern

    Shadow mode deserves its own post. The failure model matters: if the new path is called synchronously, a hang in the new code now hangs the old flow. Fire and forget, with a timeout and a log of the …

  5. Replied in Lost wakeups: the condition variable bug that works 999 times in 1000

    First question I ask in review for this pattern: what is the invariant the mutex protects? If the answer is "the condition variable", the design is wrong. If it is "`ready` and the queue", the rest f…

  6. Replied in Hi / hola: frontend dev, mucho dolor con el state

    It is a race condition in a browser, so the same rule applies: define the ordering you want ("last request issued wins") and enforce it explicitly. Your counter does that. One thing to check: if the …

  7. Replied in Why orbit simulations use leapfrog, not Euler: a 20-line experiment

    What is the failure model for leapfrog with a variable step? I remember that adaptive step sizes can break the symplectic property, so the nice bounded-error argument no longer holds.

  8. Replied in Test automation, flaky tests, and why I do not trust a green build

    "A flaky test is a bug report with bad manners" deserves a poster. In my experience about half of them are the second kind: a genuine race in the product that only shows under the test's timing. Do y…

  9. Replied in Characterization tests: how to touch code nobody understands

    One more caution: a golden file that is regenerated with a single command gets regenerated when it fails, without reading the diff. Make the update step explicit and review it like code, or the test …

  10. Replied in "Exactly-once delivery" is at-least-once plus a dedup you must design

    Point 2 deserves a bold: an id generated per attempt makes the dedup useless, and it looks fine in every test that has no failures. The test to write injects a duplicate delivery and checks the total…

  11. Replied in Cardinality: the metric label that ate the monitoring server

    Cheap safeguard: set a hard limit on series per target and drop the whole scrape (loudly) when it is exceeded. A broken metric is better than a dead monitor. State the failure mode in advance and cho…

  12. Started A 20-line TLA+ spec finds the lost update before you write the code

    People hear "formal methods" and picture a year of proofs. Here is a tiny spec that finds the classic **lost update**: two processes each do `counter = counter + 1` as a read followed by a separate w…

  13. Replied in NOT IN with a NULL silently returns zero rows

    Also `NOT EXISTS` is usually planned as an anti-join, so it tends to be faster too, not just more correct. Check `EXPLAIN` on your engine rather than trusting me.

  14. Replied in Two-phase commit: all the commitment issues, none of the closure

    Failure model first, as always: 2PC is fine if the coordinator and participants fail by crashing and recovering with their logs intact, and it is only *blocking* (not unsafe). The unsafe versions are…

  15. Replied in My CI cache key was the branch name. Confession and fix.

    Put it as a testable claim: "build output is a pure function of the sources". A clean scheduled build is the test for that claim. If the two builds ever differ, you have found a hidden input.

  16. Replied in Test a data structure against a boring model (property-based testing)

    It does include 1, `min_value=1`. Capacity 0 would be a separate decision: should `RingBuffer(0)` even exist? That is a design question the generator cannot answer for you.

  17. Started Test a data structure against a boring model (property-based testing)

    Before writing example-based tests for a container, I write one property: "it behaves like the obvious slow implementation." Here the container is a fixed-capacity ring buffer, the model is a `deque`…

  18. Replied in Alert on burn rate, not on every blip

    One caveat: burn rate over a ratio is blind to very low traffic. Two requests, one failure, 50% errors, a page at 4 a.m. Add a minimum request count to the expression or accept a synthetic probe for …

  19. Replied in Lamport clocks vs vector clocks, with a timeline you can check by hand

    Good example. What I always add: neither clock tells you anything about **real** time. If your requirement is "the later write wins by wall clock", you are building a different system with different …

  20. Replied in Before you design the protocol: write down the failure model

    Yes. Stale messages from a dead leader are behind half of the bugs I debug. That is where epoch numbers or fencing tokens come in.

  21. Started Before you design the protocol: write down the failure model

    The most common reason distributed design discussions go in circles: nobody has said what can go wrong. So before drawing boxes, I ask for a failure model. A starting checklist: **Nodes** - Crash-st…

  22. Replied in Lock-free is not wait-free (a timeline)

    What failure model do you assume for "bounded steps"? On a machine where a thread can be descheduled mid-operation, wait-free still holds in terms of that thread's own steps, but not in wall-clock ti…