Coding matters: Scary software stories

The image must show a horse on the left, with one hoof lifted and an expression of dismay on the horse's face. There must be bent and broken horse shoe lying on the ground. On the right is a man dressed in medieval armour, including a sword. But he is crying and holding a laptop in one hand. The scene is outside.

There’s a poem that (literally) dates back centuries:

“For want of a nail, the shoe was lost.
For want of a shoe, the horse was lost.
For want of a horse, the rider was lost.
For want of a rider, the message was lost.
For want of a message, the battle was lost.
For want of a battle, the kingdom was lost.
And all for the want of a horseshoe nail.”

We can picture the limping horse and its desperate rider. But the message is simple: small things can break big things. And that’s true in software development.

Little errors can bite back

If you’re a programmer, you already know this. Big problems often start with small mistakes. Like the off‑by‑one error, the assumption everyone made, or the “this will never happen” part of the code that does happen. At 02:00 on a public holiday.

Here are some famous examples of small software mistakes that caused outsized problems.

The number that broke a rocket

On 4 June 1996, the Ariane 5 rocket exploded 37 seconds after take-off. Why? A 64‑bit floating‑point value was converted into a 16‑bit signed integer. In other words, the number was too big to fit into the space allocated for it. It was like trying to pour all the tea I drink in one day into a single mug. Like the tea, the value overflowed. The guidance system failed, and so did the rocket.

The code was copied from Ariane 4, where the value never got that large. It was a safe assumption — until it wasn’t.

That small decision was enough. Data types matter.

The race that killed

A race condition happens when two parts of a system try to do something at the same time. The result depends on which part wins the race. The outcome is unpredictable. This creates a bug that is hard to recreate, because the timing has to be just so. And it is very difficult to debug.

The Therac-25 was a computer-controlled radiation therapy machine used to treat cancer patients. From 1985 to 1987 it gave fatal overdoses to several patients because of a race condition.

There were other problems too, like "black box" software. Today we have medical AI systems that are the ultimate in "black box" software. We should expect problems.

One line to break them all

A regular expression (aka regex) is a pattern that helps you find text. For example, you can look for an "@" sign and a "." to check if some text looks like an email address.

Regular expressions can solve very complex problems in a single line. But they often look like a cat tap-danced across the keyboard. And they are notoriously hard to read and debug.

Cloudflare is one of the world’s leading internet security companies. On 2 July 2019, Cloudflare went down for about 30 minutes. And a large part of the internet went down with it.

The cause? A single regular expression. One line. Global outage.

Do you have a scary software story to share? Or would you like to hear more of these? I’d love to hear from you.

If you enjoyed this, subscribe to our weekly newsletter

Leave a Comment

Your email address will not be published. Required fields are marked *

Your Java tip is on its way!

Check that incusdata.com is an approved sender, so that your Java tips don’t land up in the spam folder.

Our privacy policy means your data is safe. You can unsubscribe from these tips at any time.

Thank You

We're Excited!

Thank you for completing the form. We're excited that you have chosen to contact us about training. We will process the information as soon as we can, and we will do our best to contact you within 1 working day. (Please note that our offices are closed over weekends and public holidays.)

Don't Worry

Our privacy policy ensures your data is safe: Incus Data does not sell or otherwise distribute email addresses. We will not divulge your personal information to anyone unless specifically authorised by you.

If you need any further information, please contact us on tel: (27) 12-666-2020 or email info@incusdata.com

How can we help you?

Let us contact you about your training requirements. Just fill in a few details, and we’ll get right back to you.