hn.today

Why does shuffling the schedule find so many bugs?

fzakaria.com3 points0 comments
Screenshot of Why does shuffling the schedule find so many bugs?

Many software bugs depend less on unusual code than on unusual timing. A workflow at AWS once appeared to execute steps out of order because a worker paused long enough to miss its heartbeat; the system reassigned its task, then the original worker resumed and repeated work after the workflow had advanced. The fix was to make every step safe to repeat. This experience illustrates a broader point: routine tests often replay only a few familiar event schedules, so timing-sensitive faults remain hidden even in systems that are not distributed. Rewind VM, a deterministic virtual machine, searches for these faults by running the same program under varied schedules, including long pauses.

A two-thread counter example shows why schedule variation matters. Each thread’s increment consists of a load, an addition, and a store; of the 20 possible orderings, 18 lose an update. Yet on an idle laptop, ordinary runs produced only two orderings and no failures in 10,000 attempts. Rewind reached 15 orderings and exposed 1,371 lost updates; adding a start barrier let it reach all 20 and fail 2,997 times. Even a busy machine explored fewer schedules and found far fewer failures. The key lesson is that a bug can be common among triggering schedules while those schedules are rare in normal execution. Long stalls can create especially unusual orderings, and Rewind’s controls can encourage them, making schedule shuffling a practical way to uncover defects missed by conventional tests.

Read on fzakaria.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Other

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.