Live data from Hacker News

A single line of code cost $8000

pietrasiak.com

51–60 of 423 posts

Re: A single line of code cost $8000

#53

‘Simple’ bugs get a bit more expensive than this… https://en.m.wikipedia.org/wiki/Knight_Capital_Group#2012_st... 440m usd

The scale is astounding. I was briefly interested in the person that caused the error then immediately realized it was irrelevant because if a mechanism doesn't exist to catch an issue like that, then any company is living on borrowed time.

Re: A single line of code cost $8000

#54
post #7

Just amazed that ‘better testing’ isn’t one of the takeaways in the summary. Just amazed. Yea ‘write code carefully’ as if suggesting that’ll fix it is a rookie mistake. So so frustrating when developers treat user machines like their test bed!

How do you adjust your testing approach to catch cases like this? In my experience, timing related issues are hard to catch and can linger for years unnoticed.

I would mock/hook/monkey patch/whatever the functions to get the current time/elapsed time, simulate a period of time (a day/week/month/year/whatever), make sure the function to download the file is called the correct amount of times. That would probably catch this bug.

Although, after such a fuck up, I would be tempted to make a pre-release check that tests the compiled binary, not any unit test or whatever. Use LD_PRELOAD to hook the system timing functions(a quick google shows that libfaketime[0] exists, but I've never used it), launch the real program and speed up time to make sure it doesn't try to download more than once.

[0] https://github.com/wolfcw/libfaketime

Re: A single line of code cost $8000

#56
post #42

> 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. No, it doesn't mean that. Auto updater introduced series of bad outcomes. - Downloading update without consent, causing traffic for client. - Not only that, the download keeps repeating itself every 5 minutes? You did at least detect whether user is on metered…

App store updates are perfect: no unnecessary complications, no unnecessary work (assuming Screen Studio is published and properly updated in the app store), and the worst case scenario is notifications about a new Screen Studio version ending up in a Screen Studio recording in progress.

Thinking of it, the discussed do-it-yourself update checking is so stupid that malice and/or other serious bugs should be assumed.

Re: A single line of code cost $8000

#57

‘Simple’ bugs get a bit more expensive than this… https://en.m.wikipedia.org/wiki/Knight_Capital_Group#2012_st... 440m usd

See also: Every time a small error in a spreadsheet has caused a huge problem https://eusprig.org/research-info/horror-stories/

Re: A single line of code cost $8000

#58

Oh boy, I know of at least one case where a single line of code cost ~$500k… Curious where the high-water mark is across all HNers (:

Others have reported higher already, but for data:

Our team had a bug that cost us about $120k over a week.

Another bug running on a large system had an unmeasurable cost. (Could $K, could be $M)

Re: A single line of code cost $8000

#59
I have Screen Studio and I don't leave it open but all I wish for now is that you disable the auto updater. Provide an option for it to be disabled and allow for manual update checking. Checking for an update every 5 minutes is total overkill and downloading the update automatically is just bad. What if I was on mobile internet and had limited bandwidth and usage. The last thing I want is an app downloading it's own update without my consent and knowledge.

Re: A single line of code cost $8000

#60
post #11

I would also put into question if you _really_ need to check for updates every 5 minutes. Once per startup is already enough, and if you're concerned about users who leave it on for days, it could easily be daily or even less often.

I'd also question if the updater needs to download the update before the user saying they want it. Why not check against a simple endpoint if a newer version is available and if so, prompt the user that an update could be downloaded and then download it. This would also allow the user to delay the update if they are on metered connections.
Post reply on HN