Skip to content

Therac-25

Abstract

The Therac-25 was a computer-controlled radiation therapy machine built by Atomic Energy of Canada Limited (AECL). Eleven were installed, five in the United States and six in Canada. Between June 1985 and January 1987 six patients received massive overdoses, and several died of them. The causes were two small programming errors, a design that had removed the hardware interlocks of the earlier models, and a manufacturer that told each hospital in turn that an overdose was impossible. The 1993 investigation by Nancy Leveson and Clark Turner made the case the standard teaching example of software safety.

A Machine Without Interlocks

AECL and the French company CGR had built two earlier linear accelerators together, the Therac-6 and the Therac-20, both controlled by a DEC PDP-11 minicomputer. In those machines the computer was a convenience. Independent protective circuits and mechanical interlocks stopped the beam if the machine was set up wrongly, whatever the software did.

The Therac-25 was AECL’s own design. A prototype existed in 1976 and the commercial version was available in late 1982. It was a dual-mode machine. In electron mode, scanning magnets on the turntable spread a low-current beam to a safe concentration. In X-ray mode it fired a beam with about a hundred times the current into a target on a rotating turntable, and the target turned it into X-rays. If the high-current beam was ever switched on with the turntable in the wrong position, nothing stood between it and the patient.

AECL took advantage of the computer to drop most of the hardware interlocks and let software check the turntable position. The software was written in PDP-11 assembly language by a single programmer over several years, and it reused routines from the Therac-6 and Therac-20. AECL’s safety analysis of the machine in March 1983 considered hardware failures and gave the software no failure rate at all.

Six Accidents

On 3 June 1985 a 61-year-old woman was treated at the Kennestone Regional Oncology Center in Marietta, Georgia, and felt what she described as a burning heat. The hospital physicist, Tim Still, later estimated that she had received 15,000 to 20,000 rads where 200 had been prescribed. He telephoned AECL to ask whether the machine could overdose a patient and was told it could not.

On 26 July 1985 a patient in Hamilton, Ontario, was overdosed during her 24th treatment; she died of her cancer that November, and the autopsy found that the hip would have needed replacing because of the radiation. AECL suspected a faulty microswitch on the turntable, could not reproduce the failure, and changed the design anyway. In its report and its letters to hospitals it claimed that the change meant “an improvement of at least five orders of magnitude” in safety. In December 1985 a woman in Yakima, Washington, developed a striped burn on her hip. AECL answered the hospital’s inquiry with a letter saying an overdose was impossible and that no other incidents had occurred.

Most of what is known comes from the next two accidents, both at the East Texas Cancer Center in Tyler. On 21 March 1986 a man arrived for his ninth treatment. The operator typed “x” for X-ray where she meant “e” for electron, noticed, moved the cursor up, corrected the letter, and started the beam. The console stopped with the message “Malfunction 54” and showed that almost no dose had been delivered. The machine paused often for trivial reasons (a therapist at another clinic reported 40 dose-rate malfunctions on some days), so she pressed “P” to proceed. The video monitor to the treatment room was unplugged that day and the intercom was broken. The patient, who had felt something like an electric shock, was getting up from the table when the second pulse hit him. He died five months later. On 11 April the same thing happened to a second patient with the same operator at the console, and he died three weeks afterwards.

The Tyler physicist, Fritz Hager, took the machine out of service and sat down with the operator. She remembered exactly what she had typed. After many attempts they could produce Malfunction 54 at will. The condition was speed: if the prescription was edited within about eight seconds, the time the bending magnets took to set, the edit was not registered by the routine that set up the beam. The machine then fired its X-ray-strength beam with the turntable in the electron position. An experienced operator typed fast enough to trigger it.

The sixth accident, at Yakima on 17 January 1987, had a different cause. A one-byte variable called Class3 told the program whether the turntable was correctly placed, and a nonzero value meant “not yet”. The program incremented it on each pass through the set-up test, so on every 256th pass it rolled over to zero. If the operator pressed the “set” button at that instant, the check was skipped. The patient died in April.

The Manufacturer and the Regulator

After Tyler, AECL sent users a letter telling them to remove the cursor-up key cap and fix the switch contacts open. On 2 May 1986 the United States Food and Drug Administration declared the Therac-25 defective and demanded a corrective action plan. AECL’s first plans treated the Tyler race condition as the whole problem. After the second Yakima accident the FDA, on 10 February 1987, told AECL to advise customers not to use the machine for routine therapy, and Canada’s Health Protection Branch did the same.

The fifth and final revision of the corrective action plan was issued on 21 July 1987. Besides the software fixes it added hardware protection: an independent circuit that shut the beam down after a single pulse, and a potentiometer on the turntable to report its position. The Therac-20 turned out to contain the same editing bug. On that machine it had blown fuses and never harmed anyone, because the hardware interlocks caught it.

What Leveson and Turner Concluded

Nancy Leveson and Clark Turner reconstructed the case from lawsuits, depositions, and FDA correspondence and published “An Investigation of the Therac-25 Accidents” in IEEE Computer in July 1993. They declined to blame the two bugs alone. Fixing them, they wrote, would not have made the machine safe, because the design allowed any software error to reach the patient.

Their list of causes has been repeated in software engineering courses since. AECL reused software from machines in which hardware had hidden its errors. One person wrote the code, there was no independent review, and the documentation was thin. The risk assessment assigned numbers to hardware and assumed the software was correct. The operator interface produced so many unexplained error messages that operators learned to override them. And after each accident the company told the next hospital that no accident had happened, so every site investigated alone.

The case appears next to Ariane 5 and the Boeing 737 MAX in Famous Software Disasters; the tools later developed to exclude this class of error are described in Formal Methods and Model Checking and Software Testing and QA.

📚 Sources