China's Communist Party is 'behind spate of takeovers' of British private schools - with more than 30 now in hands of foreign investors
Man in his 70s is arrested after mobility scooter driver 'punched in the head'
Lucy Letby 'is under 24-hour guard and has to be checked on every 15 minutes'
Trains suspended on major Greater Anglia line after person hit by a train - recap
Male-Oriented App 'TeaOnHer' Also Had Security Flaws That Could Leak Men's Driver's License Photos
Read more of this story at Slashdot.
Adam Collard breaks down in tears as he bravely speaks about fianceé Laura Woods' tragic miscarriage on Celeb SAS
Teen interns brute-forced a disk install, with predictable results
Who, Me? Welcome to Monday and another instalment of Who, Me? It’s The Register’s reader-contributed column in which you admit to mistakes and reveal if they derailed your career.…
Alexa hits snooze on basic functions as alarms and timers KO'd in UK outage
Amazon's Alexa is on the fritz, bungling alarms and timers and leaving some UK users trapped in an endless wake-up call.…
A12 partially closed both ways near Colchester due to emergency repairs
Olympian outraged after being charged to REMOVE pizza toppings at Italian restaurant
3 men arrested after woman murdered in Romford as police step up patrols in the area
Psychiatrist reveals the subtle sign someone may be a psychopath
Body language expert reveals moment that proved Meghan Markle was never going to fall in line with royal protocol - and that Prince Harry was more than willing to let her take the lead
Refuge centre set up in Essex after firefighters tackle huge building blaze
Road closed in Clacton as huge fire engulfs building with residents evacuated
Someone's poking the bear with infostealers targeting Russian crypto developers
Researchers at software supply chain security outfit Safety think they’ve found malware that targets Russian cryptocurrency developers, and perhaps therefore Russia’s state-linked ransomware crews…
Kate Middleton's boho dress was an instant sell-out - we've found a mini version plus high street alternatives that are equally charming
Stylish at 40! Inside the life of birthday girl Beatrice Borromeo, the aristocrat once crowned 'most stylish European royal' - and her role in a regal relatives murder conviction
Study pinpoints how long it takes to regain weight after stopping weight loss jabs - and it's quicker than you think
CodeSOD: Going Crazy
For months, everything at Yusuf's company was fine. Then, suddenly, he comes in to the office to learn that overnight the log exploded with thousands of panic messages. No software changes had been pushed, no major configurations had happened- just a reboot. What had gone wrong?
This particular function was invoked as part of the application startup:
func (a *App) setupDocDBClient(ctx context.Context) error { docdbClient, err := docdb.NewClient( ctx, a.config.MongoConfig.URI, a.config.MongoConfig.Database, a.config.MongoConfig.EnableTLS, ) if err != nil { return nil } a.DocDBClient = docdbClient return nil }This is Go, which passes errors as part of the return. You can see an example where docdb.NewClient returns a client and an err object. At one point in the history of this function, it did the same thing- if connecting to the database failed, it returned an error.
But a few months earlier, an engineer changed it to swallow the error- if an error occurred, it would return nil.
As an organization, they did code reviews. Multiple people looked at this and signed off- or, more likely, multiple people clicked a button to say they'd looked at it, but hadn't.
Most of the time, there weren't any connection issues. But sometimes there were. One reboot had a flaky moment with connecting, and the error was ignored. Later on in execution, downstream modules started failing, which eventually led to a log full of panic level messages.
The change was part of a commit tagged merely: "Refactoring". Something got factored, good and hard, all right.
[Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.