Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • I don't really understand the purpose of this. It's not like they have anything other than the RCA (e.g. the code)
  • A lot of people view model checking and similar tools as too theoretical, academic Stuff that can't be so easily applied to the real world.

    Here we see the basic steps of modeling a complex system, and how that can be useful for understanding behavior even without knowing the details of every component.

  • Wish the author had an introduction to model checker article.

    I have yet to learn about this and will not be throwing some time into researching this topic.

  • I haven't used Alloy (alloytools.org) but it looks interesting and there are good docs. Did you mean "now" instead of "not"?
  • I don't know if this counts as "research" but this research might be helpful https://www.learntla.com/
  • imho, model checker suits for the problem with many different states and complex state transformation. But in this case, it's a simple toctou problem.. Using model checker sounds weird for me
  • Yeah, I was going to say, if anybody with distributed systems knowledge actually thought about this code, it wouldn't have happened.

    If you added model checking to it you could have prevented it though, because people that know how to program a model checking program, will see the error right away.

  • One thing I've observed in my career is that if you take the extra time / are good enough / have the experience to ship something solid enough that nobody ever thinks about it, you never get nearly as much credit as the folks who quickly ship broken things or the folks that parachute in to fix those things.

    I've changed my behavior to reflect the incentives but remain sad about it.

  • If I were to summarize how we attacked this when I was on AWS (different team)

    formal methods. Some of this started a long time ago so not sure if it was TLA, TLA+, or something else. (I am a useless manager type)

    fake clients / servers to make testing possible

    strict invariants

    A simulator to fuzz/fault the entire system. We didn't get this until later in the life of the service but flushed out race condition bugs that would have taken years to do.

    We never got to replaying customer traffic patterns which was a pet idea of mine but probably the juice wasn't worth the squeeze.

  • "juice wasn't worth the squeeze" - adding that to my vocab
  • Real world systems often have to deviate from the "pure" version used to run formal methods on. This could be how long you keep transaction logs for, or how long rows are tombstoned for, etc. The longer the time period, the costlier it usually is, in total storage cost and sometimes performance too. So you have to compromise with where you set the time period for.

    Let's imagine that the process usually takes 1 minute and the tombstones are kept for 1 day. It would take something ridiculous to make the thing that usually takes 1 minute take longer than a day - not worth even considering. But sometimes there are a confluence of events that make such a thing possible... For example, maybe the top of rack switch died. The server stays running, it just can't succeed any upstream calls. Maybe it is continuously retrying while the network is down (or just slowly timing out on individual requests and skipping to the next one to try it). When the network comes back up, those calls start succeeding but now it's so much staler than you ever even thought was possible or planned for. That's just one scenario, probably not exactly what happened to AWS.

  • In my mind, anything that has an actual time period is bound to fail, eventually. Then again, I hang around QA engineers a lot, and when you hear about the selenium troubles of "wait until an element is on the page" stories, you realise it relates to software in general.

    QA people deal with problems and edge cases most devs will never deal with. They’re your subject-matter-experts of 'what can go wrong'.

    Anyway, the point is. You can’t trust anything "will resolve in time period X" or "if it takes longer than X, timeout". There are so many cases where this is simply not true and should be added to a "myths programmers believe" article if it isn't already there.

  • Presumably that one guy at AWS who promotes TLA+ is furiously modeling all this himself in more detail for internal analysis.
  • Hah, I went to a few of his talks
  • It’s more than one person at AWS now
  • Problem with TLA+ is that it is a completely unrelated tool to the actual programming, and even when everything is done correctly, it doesn't prevent further code changes breaking the model, unless there are work processes in place to update the related model, revalidate it, and only then push the changes into production.

    As mentioned previously, I think the only tools that are really valuable should be able to produce code, naturally with multiple possible languages as backends, that are then used as library from the application code.

    Something like Lean, F*, Dafny, even if that isn't exactly the same as TLA+.

  • I'm a fan of more formal methods in progam analysis, but this particular excercise is very hindsight-is-20/20

    > In this case, we can set up an invariant stating that the DNS should never be deleted once a newer plan has been applied

    If that invariant had been expressed in the original code — as I'm sure it now is — it wouldn't have broken in the first place. The invariant is obvious in hindsight, but it's hardly axiomatic.

  • Every such analysis will have some hindsight bias. Still, it’s a great post that shows how to model such behavior. And I agree with the another reply that not deleting an active plan seems like a basic fail safe choice which the post also covered
  • > but it's hardly axiomatic.

    Agree, but Time-of-Check to Time-of-Use is a pretty well established failure mode.

  • not deleting the active plan seems like a basic fail-safe design choice, and this isn't AWS people's first rodeo. likely there was some rationale for not going with a built-in fallback.
    by pas
  • John McCarthy‘s qualification problem[0] relates to this.

    While one can and will add invariants, as they are discovered, they cannot all be found.

    Entscheidungsproblem and Trakhtenbrot's theorem apply here, counterintuitively that the validity of finite models is in co-re but not in re.

    Validity in this case is not dependent by the truth of the premise or the truth of the conclusion.

    Basically we have to use tools like systems thinking to construct robust systems, we cannot universally use formal methods across frames.

    It is one way race conditions are complex.

    Hindsight bias makes it seem easy but that is because that is in the co-re side.

    Well intended actions with hindsight can often result in brittle systems as their composition tends to set systems in stone, with the belief that axioms are the end solution.

    The fact that Gödels completeness theorem may not apply for finite systems when it works so well for infinite ones is hard for me to remember.

    Remembering that axiomatization is a powerful tool but not a silver bullet has actually helped me more than I can count.

    [0] http://jmc.stanford.edu/articles/circumscription/circumscrip...