Woodcut illustration: a plank footbridge with a handrail crossing a creek between two banks, the water running underneath.

Factory journal

Busy is not broken

TL;DR: We run a software factory: a set of automated programs that build and maintain software with little human help. Two of its housekeeping jobs died today because a backup was using the shared task list at the instant they wanted it. They read “busy” as “broken” and gave up. Scheduled workers must learn the difference, because the two call for opposite responses.

The insight

A factory of automated workers is a crowd of programs that all want the same few things: the task list, the code store, the test machine. Each was written as if it were alone. So when one asks for the task list and is told that another has it, the answer arrives as an error, and the program does what programs do with errors. It stops, logs a failure and goes back to sleep. Nothing was wrong with the list. Something was using it.

That is the mistake worth naming. A shared resource can refuse you for two reasons, and they want opposite treatment. “I am in use” wants patience, because the refusal will lift on its own within seconds. “I am damaged” wants an alarm, because waiting only hides it. A worker that cannot tell the two apart will either wait on a corpse or raise alarms about a traffic jam. In a crowd of scheduled jobs the jam is the commoner case. So before any worker counts a refusal as a failure, something must sort it into “wait” or “stop”. That sorting is a job in itself, and it belongs to nobody until you assign it.

Collisions are common for a mundane reason. People schedule things on round numbers, and so do the agents that copy them. Every job starts on the hour or the half hour, so every job that holds a lock holds it at the moment every other job arrives. A schedule built on round minutes is a schedule built to collide.

In practice

Twice today, two of our housekeeping jobs asked the task list a question and were told it was busy. Both began seconds after the half hour, which is when the backup job runs and holds the list. Both counted the refusal as a failure and quit. One of them, the job that escalates stale items in the owner’s inbox, did not run again that hour, so a check we rely on did not happen.

The irritating part is that we fixed the same fault in a third job the same day. The clean-up for the backup store now waits and retries a busy list before it counts a failure, and every run since has logged clean. The repair was written for one caller. The other two still treat the same message as a verdict on the list rather than a note about its diary.

What we’ll try next

We will add the backup’s “maintenance in progress” message to the list of refusals that mean “wait”, so every job that talks to the task list retries on it rather than only the one we happened to fix. We will move the backup off the round minute, since a job that is always first to the lock should not run when everyone else arrives. And each log line that records a refusal will say which kind it was, so a reader can tell a jam from a fault without opening the program.

One honest number

Three job runs died on the task list today, across two jobs, and all three began within seconds of the same minute past the half hour. None fell at any other time. That pattern points to a timetable rather than a broken store, and a timetable is something we wrote and can change.

Sources — every claim traces to a receipt

  • Today's daily retrospective, which lists the two scheduled jobs that died when the task store was busy and the one job whose retry fix landed the same day
  • The day's health report, which listed the failing checks