TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A single line of code brought down a half-billion euro rocket launch

137 pointsby irtefaover 2 years ago

24 comments

probablypowerover 2 years ago
&gt; &quot;A Single Line of Code Brought Down a Half-Billion Euro Rocket Launch&quot;<p>Blaming a system failure on a single point like this dooms that system to repeat similar failures (albeit in another element) in the future.<p>There are numerous testing, quality and risk controls that could&#x27;ve been in place. There are probably even a few people who didn&#x27;t do their job (besides the one person a decade ago who wrote the &#x27;single line&#x27;). The point isn&#x27;t to pin blame on any one point, but to look at the system (people, processes, technology) and try to understand why the system is fragile enough that a single person&#x27;s error is able to escalate into a half-billion euro error.<p>By focusing in on the point of failure, you end up falling victim to survivorship bias [0]. It is how you end up with developer teams swamped with unit-testing requirements and test coverage metrics, but still somehow end up with errors that impact the end-user anyway. It is how you get company surveys that always seem to miss the point, saying that the measures they implemented to improve company culture worked, yet everyone is burning out and miserable.<p>[0] - <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Survivorship_bias" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Survivorship_bias</a>
评论 #34649944 未加载
评论 #34650206 未加载
评论 #34655993 未加载
raldiover 2 years ago
This is like saying a single little match blew up a building, neglecting to mention the garage full of oily rags and gasoline cans.<p>The one line of code was the spark, yes, but the catastrophic consequences were due to a series of poorly-designed failsafes and insufficient testing.
dangover 2 years ago
Related:<p><i>Ariane 5 – Flight 501 Failure (1996)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30556601" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30556601</a> - March 2022 (1 comment)<p><i>An overflow error costing 500M dollars (1996)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18939625" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18939625</a> - Jan 2019 (20 comments)<p><i>The Explosion of the Ariane 5</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=5331474" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=5331474</a> - March 2013 (58 comments)<p>There must be others. Anyone?
WalterBrightover 2 years ago
&gt; The system is designed to have a backup, standby system, which unfortunately, runs the exact same code.<p>At Boeing, the backup system runs on a different CPU architecture, with a different program design, a different programming language, and a different team that isn&#x27;t allowed to talk with the team on the other path.
评论 #34650111 未加载
评论 #34649936 未加载
评论 #34649901 未加载
enraged_camelover 2 years ago
&gt;&gt; The cause? A simple, and very much avoidable coding bug, from a piece of dead code, left over from the previous Ariane 4 mission, which started nearly a decade before.<p>&gt;&gt; The worst part? The code wasn’t necessary after takeoff, it was only part of the launch pad alignment process. But sometimes a trivial glitch might delay a launch by a few seconds and, in trying to save having to reset the whole system, the original software engineers decided that the sequence of code should run for an extra… 40 seconds after the scheduled liftoff.<p>The author appears to be using a different definition of &quot;dead code&quot; than I&#x27;m used to. To me, dead code is code that is no longer called by anything else, and has no chance of running. Maybe a more accurate term is &quot;legacy code&quot;?
joshAgover 2 years ago
&gt; With 16-bit unsigned integers, you can store anything from 0 to 65,535. If you use the first bit to store a sign (positive&#x2F;negative) and your 16-bit signed integer now covers everything from -32,768 to +32,767 (only 15 bits left for the actual number). Anything bigger than these values and you’ve run out of bits.<p>That&#x27;s, oh man, that&#x27;s not how they&#x27;re stored or how you should think of it. Don&#x27;t think of it that way because if you think &quot;oh 1 bit for sign&quot; that implies the number representation has both a +0 and a -0 (which is the case for ieee 754 floats) that are bitwise different in at least the sign bit, which isn&#x27;t the case for signed ints. Plus, if you have that double zero that comes from dedicating a bit to sign, then you can&#x27;t represent 2^15 or -2^15, because you are instead representing -0 and +0. Except, you can represent -2^15, or -32,768, by their own prose. So there&#x27;s either more than just 15 bits for negative numbers or there&#x27;s not actually a &quot;sign bit.&quot;<p>Like, ok, sure, you don&#x27;t want to explain the intricacies of 2&#x27;s complement for this, but don&#x27;t say there&#x27;s a sign bit. Explain signed ints as a shifting the range of possible values to include negative and positive values. Something like<p>&gt; With 16-bit unsigned integers, you can store anything from 0 to 65,535. If you shift that range down so that 0 is in the middle of the range of values instead of the minimum and your 16-bit signed integer now covers everything from -32,768 to +32,767. Anything outside the range of these values and you’ve run out of bits.
评论 #34650550 未加载
评论 #34659406 未加载
评论 #34658217 未加载
opportuneover 2 years ago
I have found that among software engineers, it is surprisingly not common knowledge that floating point operations have all these sharp edges and gotchas.<p>The most common situation in which it crops up is when dealing with quantities that require fractional units&#x2F;arithmetic of some commonly discrete unit of measure. For example, you implement some complex logic to do request sampling, and in your binary you convert the total number of active requests to a float, add some stuff, divide some stuff, add some more stuff, multiply it again, then convert back to an int something like “number of requests that should be sampled.” Because floating point operations are non-associative, non-distributive, and commonly introduce remainder artifacts, you can end up with results like sampling 1 more request than there are total requests active, even when the arithmetic itself seems like that should be impossible.<p>This is also common when dealing with time, although typically the outcome is not that bad. Despite time having a simple workaround of just changing the unit of measure (eg using milliseconds instead of seconds) and using int operations on that, because people don’t know <i>why</i> they shouldn’t use floating point operations in this case, they don’t always reach for it.<p>The worst is when some complicated operation is done to report a float (or int converted from a float) as a metric. In the request sampling example, that would likely be noticed quickly and fixed. But when the float value looks reasonable enough and doesn’t violate some kind of system invariant, it can feed you bad data for a very long time before someone catches it.
评论 #34650010 未加载
pugworthyover 2 years ago
September 12-13.<p>An oceanographic research ship is doing gravity and magnetic surveys off the coast of Brazil.<p>Suddenly, data acquisition software crash!<p><pre><code> byte day_of_year;</code></pre>
评论 #34649776 未加载
jakeinspaceover 2 years ago
I’m very happy that the flight software codebase I’m currently working on doesn’t use any floating point. We don’t even have FPUs enabled. Then again, it’s not GN&amp;C do the stakes are not as high.
xwdvover 2 years ago
I hate these “single line of code did X” type headlines.<p>It will <i>always</i> be a single line of code. The nature of most programs is to execute commands in a sequence. Eventually you hit one that fails.<p>Hell, you could reduce it to even be less than a line of code. It could be a single variable. A single instruction. It could be a couple bits. A couple bad 1’s and 0’s in memory blew up a multibillion dollar rocket launch.
photochemsynover 2 years ago
&gt; &quot;To achieve this, the guidance system converts the velocity readings, from 64 bit floating point to 16 bit signed integer&quot;.<p>Oh, excellent possible interview question? &quot;Write some code that reliably converts the full range of possible 64 bit floating point values to a 16 bit signed integer. What are the issues you&#x27;ll have to deal with and what edge cases might arise?&quot;
评论 #34652013 未加载
评论 #34650471 未加载
评论 #34650034 未加载
评论 #34649967 未加载
twawaaayover 2 years ago
Why would the program react like that to a SINGLE wrong signal that disagrees with everything else and produce a signal that cannot do anything good in any circumstances? This just smells like a truly naive piece of implementation.<p>There should be layers upon layers of safeties to prevent this dumb thing from happening. The computer should know the position, orientation and velocity of the rocket at any point in time and new signals should be interpreted in the context of what the computer already knows and in context of what other sensors are telling. It is not like the rocket can turn itself around in 1ms and if it does there probably isn&#x27;t much it can do anyway.<p>This suggests to me the problem is not the bug, it is the overall quality of development.
评论 #34650174 未加载
评论 #34651066 未加载
评论 #34650094 未加载
martyvisover 2 years ago
Even very earth tied machines suffer similar issues. I worked on what was known as a &quot;hot leveller&quot; computer, a PDP-11&#x2F;73 at the steelworks I was employed at. It had something like 9 rolls (maybe 200mm in diameter) that would be applied to a very hot steel plate (maybe 10mm to 150mm thick) after it had been rolled from a maybe 300mm thick slab.<p>The levellers job was to smooth out any waves that might have acquired during the rolling process - almost like a clothes iron. The gap between the rolls needed to be adjusted by hydraulically positioning backup rolls that are even able to bend those work rolls across their width (maybe 3000mm). As you are always intending apply a huge amount of force anyways, to achieve the desired results, it was a mix of metallurgical driven algorithms and hard limits to doing the &quot;setup&quot;.<p>While there was always an operator that had to accept the setup before the run, there was always the risk of hitting the machines surfaces too hard, and straining components, and maybe causing a prolonged as expensive outage. Obviously the biggest risks were when there were changes or even experiments by both engineers and metallurgists. It was fun times as a quite junior engineer, and think there were a few times when over zealous setups resulted in some big noises. But I don&#x27;t think I broke anything fortunately.
tpoacherover 2 years ago
How can you write a whole article about &quot;a single line of code&quot; and not have that line appear anywhere in the article?<p>Even worse, why was I completely unsurprised, nay expecting this to be the case when I clicked?<p>(to the article&#x27;s credit, it didn&#x27;t quite start in the typical &quot;George was walking his dog home when he noticed something wrong&quot; fashion...)
jasontedorover 2 years ago
I think James Gleick had a much better write up about this: <a href="http:&#x2F;&#x2F;www.maths.mic.ul.ie&#x2F;posullivan&#x2F;A%20Bug%20and%20a%20Crash%20by%20James%20Gleick.htm" rel="nofollow">http:&#x2F;&#x2F;www.maths.mic.ul.ie&#x2F;posullivan&#x2F;A%20Bug%20and%20a%20Cr...</a>
elashriover 2 years ago
I think this story about code is to software engineering what the Nokia story is to business
simondotauover 2 years ago
It&#x27;d probably be more accurate to say that a technology environment which allowed any single line of code to cause catastrophic failure is what brought down the launch. Or a failure of sufficiently accurate testing brought down the launch.
albert_eover 2 years ago
How many such errors may have happened on successful projects but never got post-mortemed because there was luckily no catastrophic failure
motohagiographyover 2 years ago
Millions of lines of code was what brought down that rocket launch. Saying it was one line just absolves everyone else.
thedgover 2 years ago
did you know that one time an integer overflow caused 184 billion bitcoins to be minted
评论 #34649430 未加载
Kukumberover 2 years ago
The world is not ready for the &quot;Epochalypse&quot;, let&#x27;s see what will collapse first, our civilization or our computers<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Year_2038_problem" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Year_2038_problem</a>
评论 #34649643 未加载
评论 #34649391 未加载
评论 #34649369 未加载
jaynateover 2 years ago
Wow. It makes you wonder what other types of bugs could exist?
monksyover 2 years ago
What was their unit test coverage?
phkahlerover 2 years ago
&gt;&gt; However, the reading is larger than the biggest possible 16 bit integer, a conversion is tried and fails. Usually, a well-designed system would have a procedure built-in to handle an overflow error and send a sensible message to the main computer. This, however, wasn’t one of those cases.<p>This is so unbelievably untrue. I&#x27;ve never seen code anywhere that waits to fail before doing the right thing.<p>This is exactly why I think exceptions are mostly useless, someone has to anticipate the problem, so why not write something that works right the first time. There are cases where exceptions can happen, but I don&#x27;t think floating point arithmetic should be considered one of those cases.
评论 #34649514 未加载
评论 #34652089 未加载