Skip to content
The Point of Failure

Episode 03 · The Tiny Bug Hall of Fame · 1:33

The Song That Broke YouTube's Math

00:53 · Point of failure

Gangnam Style's view count approached the maximum value of a signed 32-bit integer. YouTube widened the counter before it overflowed, a friendly example of a failure mode that is much less friendly in systems that cannot be patched in time.

Editions

Read
The Day Gangnam Style Broke YouTube's Mathtechnical debrief · zof.ai

Incident

System
YouTube's public video view counter
Date
December 2014
Location
YouTube worldwide
Toll
No public outage; YouTube widened the counter before the signed 32-bit limit was exceeded.
Topics
integer overflow · scale · assumptions · software limits · youtube

Point of failure

The view counter's signed 32-bit representation assumed that a video would not exceed 2,147,483,647 views; YouTube replaced it before the value overflowed.

Transcript

188 words · 1 min read

Cold open

One song got so popular it hit the biggest number YouTube's computers could physically count. This is The Point of Failure, episode three.

Two billion views

2014. Gangnam Style is eating the internet. The first video in history heading past two billion views.

And inside YouTube, someone realizes that is a problem with... math.

The number in the box

Computers store numbers in fixed-size boxes. YouTube's view counter used a box called a 32-bit integer.

The biggest number it can hold: 2,147,483,647.

One more view than that, and the number wraps around... into the negatives.

The assumption expires

Point of failure

Nobody who built that counter imagined one video getting two billion views. Why would they?

Then one song from Seoul made the impossible number... arrive.

YouTube quietly updated the counter to 64-bit. New limit: nine quintillion.

And here is why this matters. This exact same bug, a number outgrowing its box, has blown up rockets, lost spacecraft.

Same bug. I'll tell you those stories soon.

Every failure has a story. Every story was preventable. I'm Kevin.

Sources

5 sources

  1. YouTube's statement on the Gangnam Style view counter

    YouTube (Google+ post, archived by the Internet Archive) · 2014

    The primary record: YouTube's own statement, posted 1 December 2014 and preserved in a Wayback Machine capture of 5 December 2014 (Google+ closed in 2019). "We never thought a video would be watched in numbers greater than a 32-bit integer (=2,147,483,647 views), but that was before we met PSY. 'Gangnam Style' has been viewed so many times we had to upgrade to a 64-bit integer (9,223,372,036,854,775,808)!" The 64-bit figure is YouTube's; the signed maximum is 9,223,372,036,854,775,807.

  2. No, Psy's 'Gangnam Style' Did Not Break YouTube Video Counter

    Variety · 2014

    Report of 5 December 2014 that quotes the statement and adds YouTube's clarification: "We updated the counter to 64-bit months ago", and the spinning digits people saw on the page were "an easter egg". The basis for the incident record: the counter was widened first, and never overflowed.

  3. 'Gangnam Style' proved to be swan song for YouTube's view limit

    PBS NewsHour · 2014

    Report of 4 December 2014: the video had passed 2,147,483,647 views, "the maximum possible views YouTube's previous counter allowed", and the new counter permits "more than nine quintillion". Carries Google's line that it "saw this coming a couple months ago and updated our systems to prepare for it".

  4. Gangnam Style Has Been Viewed So Many Times It Broke YouTube's Code

    TechCrunch · 2014

    Independent report of 3 December 2014 that sets out both ranges: −2,147,483,648 to 2,147,483,647 for a 32-bit integer, and up to 9,223,372,036,854,775,807 ("9 quintillion") for 64. The wrap into negative numbers in the transcript is the general behaviour of a signed integer; no report says YouTube's counter did it.

  5. Gangnam Style is the first video to reach 2 billion YouTube views

    Google Asia Pacific Blog / YouTube · 2014

    YouTube's record of 3 June 2014 that the video "crossed 2 billion views, making it the first video to reach this milestone", the basis for "the first video in history heading past two billion views".

  1. 01

    The Update That Stopped the World

    On 19 July 2024, a flawed CrowdStrike content update crashed Windows machines around the world. The failure was not an attack: it was a release path that trusted a validator which had accepted the configuration it was meant to stop.