A single line of code cost $8000

https://news.ycombinator.com/rss Hits: 6
Summary

TLDRDue to a bug, our screen recorder app - screen.studio app kept downloading the auto-update file repeatedly, every 5 minutes for every single user. The update file is approximately 250MB. This resulted in 9 million file downloads and more than 2 petabytes (2,000,000 gigabytes) of traffic on Google Cloud.This screenshot might not look so scary at first, but take a look at the scale of it. For over a month, we generated at least 100Mib/s (a second!) and, at times, almost 1GiB/s of traffic (every single second!)That bug was painfully simple and stupid.Screen Studio is a screen recorder for macOS. It is desktop app. It means we need some auto-updater to allow users to install the latest app version easily.The app checks for the update every 5 minutes or when the user activates the app.Normally, when the app detected the update - it downloaded it and stopped the 5 minutes interval until the user installed it and restarted it.Tragic refactorThe problem with the auto-updater we had was that it would prompt the user to update the app as soon as it became available. This resulted in a popup appearing while users were recording the screen, which obviously provided a bad experience as it interrupted the recording the user was making.While refactoring it, I forgot to add the code to stop the 5-minute interval after the new version file was available and downloaded.It meant the app was downloading the same 250MB file, over and over again, every 5 minutes.Tragic context - app running in the background for weeksIt turns out thousands of our users had the app running in the background, even though they were not using it or checking it for weeks (!). It meant thousands of users had auto-updater constantly running and downloading the new version file (250MB) over and over again every 5 minutesThe mathLet’s do some quick math here.Doing something every 5 minutes means doing it approximately 288 times a day.The update file is about 250 MB, meaning 72 GB of downloads per user daily.W...

First seen: 2025-04-29 06:22

Last seen: 2025-04-29 14:23