Musing: Code Oddities
The Market Ticker - Commentary on The Capital Markets
Logging in or registering will improve your experience here
Main Navigation
Full-Text Search & Archives
Legal Disclaimer

The content on this site is provided without any warranty, express or implied. All opinions expressed on this site are those of the author and may contain errors or omissions. For investment, legal or other professional advice specific to your situation contact a licensed professional in your jurisdiction.

NO MATERIAL HERE CONSTITUTES "INVESTMENT ADVICE" NOR IS IT A RECOMMENDATION TO BUY OR SELL ANY FINANCIAL INSTRUMENT, INCLUDING BUT NOT LIMITED TO STOCKS, OPTIONS, BONDS OR FUTURES.

The author may have a position in any company or security mentioned herein. Actions you undertake as a consequence of any analysis, opinion or advertisement on this site are your sole responsibility.


Market charts, when present, used with permission of TD Ameritrade/ThinkOrSwim Inc. Neither TD Ameritrade or ThinkOrSwim have reviewed, approved or disapproved any content herein.

The Market Ticker content may be sent unmodified to lawmakers via print or electronic means or excerpted online for non-commercial purposes provided full attribution is given and the original article source is linked to. Please contact Karl Denninger for reprint permission in other media, to republish full articles, or for any commercial use (which includes any site where advertising is displayed.)

Submissions or tips on matters of economic or political interest may be sent "over the transom" to The Editor at any time. To be considered for publication your submission must include full and correct contact information and be related to an economic or political matter of the day. All submissions become the property of The Market Ticker.

Considering sending spam? Read this first.

2021-08-25 07:00 by Karl Denninger
in Musings , 419 references Ignore this thread
Musing: Code Oddities
[Comments enabled]

Yeah, it'll never get commercially distributed as I made that decision a number of years ago, and have published multiple articles on why I will take this one to my grave with me.

But let me tell 'ya -- sometimes, as a coder, you just sort of scratch your head.

This was one of them.

The codebase that runs the house here hasn't been updated since I bought the place; that's about a year and a half.  No real reason to; it's been working just fine.  But, I decided I'd go ahead and roll forward the OS version in question.

So I grab my test box (to boot the new one and make sure it works), do the cross-build (the target is an ARM processor), stick the resulting SD card in the test machine and..... it doesn't boot.

Wait.... wut?

So off I go to find that the upstream U-Boot was updated and it renumbered the MMC slots, putting the SD card outside of the ones checked for a bootable operating system.  Sort of like the old-style DOS machines that could boot two drives; you could attach more disks, but only one of the first two could boot.

How long has this been undetected in said upstream?  A couple of months!  Who the hell is checking this stuff?  Nobody, apparently.  Thanks guys.

So I put the older u-boot code back and now it starts and then fails to boot again.  Some more head-scratching ensues and I remember that between 12.0 and 12.2 this bit me on AMD64 code too as the OS folks stopped updating the old "Boot1" style loader for EFI and thus it could not identify a bootable partition.  That one was not hard to fix; find the loader that is being kept up to date in the object tree and make sure that gets copied into the EFI partition so it gets loaded.

Ah, now the OS boots and runs.  All done, right?

Not quite.

The various battery-powered sensors I have around the house do not fully initialize on a cold start for about an hour, because they have to "check in"; they're not listening all the time for battery consumption reasons, so you can't poll them until they do check in.  The first time they check in the system is unaware of all their capabilities so it has to perform a series of queries and set the device's configuration.  By the time it has done this the unit has probably gone back to sleep, so it requires two intervals before you get good data.  Not a big deal and these units do immediately respond to stimulus (e.g. motion detectors); it's just the periodic reporting of things like temperature that don't get added into the stack of maintenance requests until the system has the manufacturer-specific ID and thus knows exactly what the device is (and can do.)

Well, about an hour later it's 85F outside, the outside temperature sensors have checked in and the HVAC system goes into heating mode.  It doesn't heat, obviously, as the setpoint is way below the room temperature but..... what the ****?

Putting that particular event test in debugging mode (where it logs everything as it performs the tests) says that...... the ambient test for outside temperature < 55F indeed passed.  Uh, how, given that said sensor is reporting 85.6F?

Much head-scratching ensues along with code-staring.

I did find and fix it -- a dangling (not properly initialized) result variable in one of the test stanzas which then propagated through the tests and, since it was "True" that's what came back even though it wasn't.

For how long has this code been there and run perfectly-well in this state?  I looked back at the git log: I hadn't touched this section of the software for more than three years!

File it away as "old bug but one that never stung me before."

Yeah, you think you didn't miss anything.... and most of the time you're right.  This one time, however, well.....

Such is the life of a coder.... 

Go to responses (registration required to post)
 

 
Comments.......
User: Not logged on
Login Register Top Blog Top Blog Topics FAQ
Showing Page 1 of 2  First12Last
User Info Musing: Code Oddities in forum [Market-Ticker]
Whitehat
Posts: 5909
Incept: 2017-06-27

Elsewhere
Report This As A Bad Post Add To Your Ignored User List
Quote:
Such is the life of a coder....

you admit it, much praise. Most don't. Most of the public does not understand the gravity of the situation.

----------
smiley

"Better to reign in Hell, than serve in Heaven," Satan's monologue in the first book of John Milton's Paradise Lost
Blanca
Posts: 175
Incept: 2020-07-25

Report This As A Bad Post Add To Your Ignored User List
We've all been bitten by this kind of stuff. Most software does not run 24/7 for a year without any problems. Congrats!
Ckaminski
Posts: 6080
Incept: 2011-04-08

Report This As A Bad Post Add To Your Ignored User List
old bug but one that never stung me before.


I have a bunch of these I'm fighting with now. Oof.

Your issues are a symptom of poor CI testing. There's no reason a bootloader couldn't be married to a few VMs and beaten to death as part of a regular test suite. Maybe 20 years ago this was hard needing all hardware configuration but that's not the case anymore.

VirtualBox is one of the most configurable and scriptable tools out there for this and it's free.
Crabbucket
Posts: 9
Incept: 2021-01-26

Report This As A Bad Post Add To Your Ignored User List
Hey KD. Being able to debug code is a good sign as far as the mental fog that the coof can cause. I'll admit it's affected me and it's been a slow road back. I stopped doing anything like that until a couple of weeks ago because I was screwing things up.

We have yellow jackets all over the place since the black cherry trees have dropped berries everywhere. I've gotten swarmed by them several times over the years and had to jump in the river to stop the attack (the bastards hovered waiting for me to surface). I felt really weird for a day or two but didn't go into shock. Now I think I would have serious problems surviving that amount of stings. I'm older than you and it gets harder recovering from damn near anything.

Thanks to following the Market Ticker for years I'm prepared better than most and don't have any health problems other than Lyme disease which I keep getting due to all the deer ticks around here. I'm not on any prescription drugs at all which is unusual at my age.

When covid hit us in early 2020 I was taking Doxycycline to treat Lyme and was already taking Ivermectin because it worked wonders reducing joint pain and swelling which had me using a cane to get around. The symptoms were like a mild cold infection except the brain fog set in. Now I'm coasting along with just IVM and Turmeric and the occasional Ibuprofen and have started running again and keeping the beach clear of logs with the tractor.

I try to get the word out about your posts as much as possible which got me perma-banned from twitter. I'm done with them but I can still get to your tweets by constantly deleting their cookies and Local Storage data. Otherwise, twitter covers everything up with a window trying to force me to login or register.

Thanks again KD for the math and science based posts coming from an old FORTRAN and C guy. Also thanks to the long time posters here whose comments really make my day.

Hope this first post passes the audition.
Onelegged
Posts: 698
Incept: 2009-11-13

NW Colorado
Report This As A Bad Post Add To Your Ignored User List
I got the part about Electronic Fuel Injection...

----------
The light at the end of this tunnel is a train. It's gathering speed. It's also delivering your special box car. Showers are on the right...
Blackcrow
Posts: 106
Incept: 2021-04-04

Texas
Report This As A Bad Post Add To Your Ignored User List
I understood about 10 words of that, lol.

And here I was, so proud of myself for setting up my Roku streaming device in my house!!!!

I am humbled before greatness.
Augeries
Posts: 225
Incept: 2019-09-26

North of Boston, but not North enough.
Report This As A Bad Post Add To Your Ignored User List
Don't know much on the subject, but in my experience neither does the IT support.

I'll give a quick example. My workplace is a large manufacturing center for a very large company that makes some very important products. You'd think we'd have the best equipment, but a lot of stuff is mickey moused to a shocking extent.

A machine I ran for a few years ran connected to a desktop computer. Every time that PC lost power or was shutoff, the connection would fail and we would need IT to come rescue us. I eventually figured out how to rescue myself. Turns out that the com-ports have a habit of randomly reassigning their ID numbers. Solution? Select the com-ports at random until the connection goes through.

That setup is still run that way, for probably 15ish years now. The solution to integrate properly would be $2000, but there's no budget for it. By my math we lost $23000 in one year do to lost production time from that one issue.

Too bad. Too bad.

----------
I'm Team Virus. It Deserves to Win.

The World is Quiet Here
Tickerguy
Posts: 176905
Incept: 2007-06-26
A True American Patriot!
Report This As A Bad Post Add To Your Ignored User List
@Ckaminski - The boot problem, yes. But that one wasn't mine; it was the core FreeBSD team's, and considering that ARM64 is now considered "Tier 1" (fully supported, no caveats) it was more than a bit annoying to find that one the hard way, especially considering that the upstream change that was pulled into the FreeBSD package system had a 2021-07 date on it, so the screwing was more than a month old and undetected by them over that period of time. That one made ALL RPI 3b units unbootable, including on the official builds that you can download from FreeBSD's servers in alleged "grab them and go" condition. Since I use ZFS putting the older copy back, once I realized what had happened, was very fast. It will be interesting to see how long it is before upstream fixes what they ****ed up -- u-Boot is not FreeBSD's code at all so their blame is entirely in the "pulled it over without checking it" category, but whatever got changed in the source isn't their responsibility as an executive decision was made a long time ago to NOT patch the upstream u-Boot code for continuity reasons; they didn't do it in other words -- they grabbed someone else's ****-up.

The *second* boot problem is a bit more-obscure because I build for fully power-safe on these devices, and damn near nobody does. The out-of-box cross-compile (that runs with the SD card mounted "normally") probably puts the correct EFI loader where it belongs, since it certainly does for AMD64 at this point. Like I said, that one bit me on my big box a while ago and was arguably my fault there too since that box has been a "roll forward" across so many major revisions of the OS I can't count them, and I missed an announcement years ago that the legacy loader was no longer being maintained. "Automatic" updating of the boot code is not done by FreeBSD's update system for very, very good reasons, including the sort of annoying bull**** that happens (e.g. loss of multi-OS boot) when you do, and which Windows is known for doing to people without warning.

As for the third bug, well, that one's a bit different. That SHOULD HAVE ****ed me years ago (and of course been immediately investigated and fixed); exactly how that NEVER caused a failure before is pure mystery and, in all probability, pure luck too in terms of how heap was allocated across three or four major OS revisions and countless minor ones. Two characters missing in one place (and only there; in all the other related test stanzas, of which there are several dozen, it's correct) and it simply never caused a bad result to be returned -- until now.

----------
I don't give a flying **** if you're offended.

Indianarube
Posts: 155
Incept: 2020-03-22

NW Indiana
Report This As A Bad Post Add To Your Ignored User List
Ah. I was wondering what happened to "Home Daemon" software. I recall you had the code for sale. IIRC, it is pretty bulletproof, and requires *NO* cloud storage. I was concerned that some large corporate entity would snatch it up and quash it. Didn't you offer it for free at one point (with ZERO security) to folks wanting to try it?

KD writes
Quote:
Yeah, you think you didn't miss anything.... and most of the time you're right. This one time, however, well.....

Such is the life of a coder....
I used to watch "This Old House" when Norm Abram was the master carpenter. I used to be frustrated that he NEVER made a mistake. Nobody is that good. It takes a big man to admit his ****ups.
Gianmarko
Posts: 202
Incept: 2013-03-11

Bern, Switzerland
Report This As A Bad Post Add To Your Ignored User List
this sort of things, with which i am very familiar, having worked as professional tester, and having coded in a form or another for over 40 years, is why i will never get a so called self driving car

i have a homebuilt and homecoded anti burglar system that some time ago sprang a really funny bug. code was 100% correct (very simple code, same code used several times in the same application) but a certain digital pin would go high when a certain variable was reassigned.
changing name to the variable fixed it.
probably a bug somewhere in the compiler or some library.
they say i am just getting old and grumpy, but quality of sw is generally becoming very sketchy, testing is optional, and nobody seem to care about things not working as they should.

the solution to sw bugs is always to load the latest version, whether such version contains worse bugs than the previous one seems to never cross anyone's mind.
Scottj175
Posts: 288
Incept: 2010-09-06

Vandiver, AL
Report This As A Bad Post Add To Your Ignored User List
Yep. I've been a code slinger professionally since 1996. Don't think I'm at your level but I do get it.

I've had many of those "how in the world did I miss that?" situations. What's even worse is when you review a block of code and think "what idiot did this" and then realize YOU did many years ago. You wonder if it was merely inexperience or if perhaps you'd taken a blow to the head before writing it.

BTW, would love to have your thoughts on agile/kanban/etc dev methodology. I've been at the same gig since 2012 and have been quite happy until about 2 years ago when a new CIO came aboard and whiteboards and sticky notes started appearing all over the place. Now they exist in virtual form. But all this slaves to the process stuff is starting to make me rather miserable. I keep hoping it'll get better because I LOATHE job hunting.
Tickerguy
Posts: 176905
Incept: 2007-06-26
A True American Patriot!
Report This As A Bad Post Add To Your Ignored User List
@Scottj175 - ALL so-called "rapid development/prototyping" models are DOG****. Every one of them is nothing more than a sop to sloppiness and typically comes with an utterly ridiculous PERMANENT performance penalty.

The same is true for most so-called "modern" coding languages. Putting the language in charge of things like memory management puts a permanent performance bottleneck in the software and, much worse, exposes previously written and correct code to the risk of a runtime update that contains a bug and thus ass****s you across myriad applications all at once. It is reasonable, in some cases, to prototype in such an environment but production is an entirely different thing.

In short from my point of view if you can't hire competent people to write software the answer is not to take the responsibility for it being correct and replace that with some compiler or development environment that is now charged with silently and automatically fixing coding ****ups.

Further, the closer to assembly language you are the more-efficient the software will be, assuming the person doing the coding is REASONABLY competent. If you can't manage said process and APIs across a group of coders then you as a manager suck; the answer is not to delegate the responsibility to a compiler but to have competent people do the job.

----------
I don't give a flying **** if you're offended.

Scottj175
Posts: 288
Incept: 2010-09-06

Vandiver, AL
Report This As A Bad Post Add To Your Ignored User List
Heh...stepping on my toes there with the languages thing :)

My professional career spans Informix 4GL, VB 3, 5 & .Net, C#, a smattering of COBOL and some odds and ends like awk and Unix shell scripting. My resume lists HTML under languages but IMO it's not really. Oh and there was a brief four month adventure into Microsoft Dynamics AX and its built in X++ language. So I'm likely what you rant about there.

But I find your assessment of the modern methodologies accurate.

One of the thing that annoys me is that the schools appear to only teach framework and tool usage these days an no theory. I ranted on it a couple months ago as I was having a back and forth with a vendor's coder and he seemed to have ZERO grasp of the concept of code scope when identifying WHERE a particular logged error was coming from.
Tickerguy
Posts: 176905
Incept: 2007-06-26
A True American Patriot!
Report This As A Bad Post Add To Your Ignored User List
Yep @Scottj175 -- that's the world we live in today.

If you want to see the product of a barrel of ****ing monkeys writing code grab AOSP (Android) and go through some of it. It's a ******ned MESS and is the reason that there are myriad security patches against the same piece of the code, specifically the media server, that show up virtually EVERY ****ING MONTH.

The ONLY rational way to write anything to run on Android is, of course, Google's RDE ("Android Studio") which makes the problem worse since it FORCES you into one of two language choices (Kotlin or Java) and both suck big ones. Honestly I consider NEITHER an appropriate production language but, in reality, you basically have zero choice if you're writing something that is supposed to execute on an Android phone.

Sometimes it is what it is whether you like it or not.

----------
I don't give a flying **** if you're offended.
Scottj175
Posts: 288
Incept: 2010-09-06

Vandiver, AL
Report This As A Bad Post Add To Your Ignored User List
Ugh, Java, I hate it (and its inept little brother JavaScript) with the fire of 10,000 suns. Blogger Steve Yegge has a great rant about it called "Execution in the Kingdom of Nouns".

My path into IT is an odd one. The interest sprouted WAY back in the 80s as an outgrowth of being into video games. I wanted an IBM XT but my parents said it was too expensive and I think maybe they feared I'd pull a stunt like the kid in "War Games". So I got a VIC-20 instead and was forbidden a modem. At least I got to play with BASIC.

Interest fell off by the time I was in late high school into college. I sort of lost direction in College and wound up dropping out and turning to one of my other interests to earn a living and spent 5 years as an auto parts counterman.

4 of those years were at an independent parts store where inventory was managed with sold parts being written on notes and spindled then compiled to a spiral notebook at the end of the day and then called into the warehouse for resupply. The supplier had a PC based system to do all that and I tried and failed to convince the owner it was the way to go. But it was the spark to return to school and complete a degree in MIS.

There's where I discovered I have a knack for it. The school used COBOL to teach logic (and act as a weed-out course) and I breezed through it to the point the MIS department hired me as a tutor.

The rest, as they say, is history. I've never been as deep in the weeds as machine languages and honestly I don't consider myself all that innovative. Although I've done some cool stuff like write an ASCII to EBCDIC converter for VB3 when I discovered one didn't exist. My real talent I think is being able to look at code and run it in a debugger to figure out why something isn't working. Unfortunately that talent doesn't seem to fit well into all this new methodology-driven nonsense.

I've not done any coding outside of work in years. All my hobby time has been dedicated to guns and/or cars for quite some time. I should probably do more stuff just for fun.
Gianmarko
Posts: 202
Incept: 2013-03-11

Bern, Switzerland
Report This As A Bad Post Add To Your Ignored User List
"my point of view if you can't hire competent people to write software the answer is not to take the responsibility for it being correct and replace etc etc"


fact is, big sw companies will never hire competent people. first, they think they cost too much, second, folks writing code must be replaceable at any time and place. companies will not hang their fortunes to the presence of X guy who can code. and any guy will be eventually replaced by some indian or chinese, writing code in an environment where coders are completely isolated by the consequences of their poor work. which is the real problem because india has excellent engineers, but they overall dont give a ****. and turnover is wild.

coding is done on the lowest possible denominator, and coders are more often than not at the bottom step of the company ladder.

agile was supposed to be a way to fix the shortcomings of such >system<; you run 2-3 weeks cycles where you spend most of the time fixing crap written in the previous sprint. managers love it because it improves cash flow, and it probably does.

customers have been in the meanwhile trained into accepting abysmal stuff, with the promise that next release will be so much better.

in my company we still manage, through miracles, wheer willpower and cheating, to produce some stuff that is ok-ish, but the environment is overall as described above.

but hey. is cheap. or free.
Tickerguy
Posts: 176905
Incept: 2007-06-26
A True American Patriot!
Report This As A Bad Post Add To Your Ignored User List
@Gianmarko -- I understand all of that of course. Competent coders ARE expensive.

$ uptime
11:42AM up 2 days, 3:26, 1 user, load averages: 0.10, 0.14, 0.15

And here is a representative sample of its end to end response time to stimulus (e.g. someone walking into a room)

29:[Sarah Motion - Bat 100%] {100% - 53/301/133 avg 59ms, rcvd 572} 00:04
30:[MBath Motion - Bat 60%] {99% - 23/457/24 avg 33ms, rcvd 459, XTO: 3, XF: 0} 01:02

About 40ms response time consuming about 10% of the available CPU on a quite-slow piece of crap (RPI3 with 1Gb of RAM) oh, and this is while buffering multiple cameras included in the overhead so you can have real-time lookback all the time as well.

Try doing that in some RDE and let me know what the CPU and RAM requirements are to actually have the work with anywhere near that level of performance.

----------
I don't give a flying **** if you're offended.
Seektruth
Posts: 1122
Incept: 2007-09-01
A True American Patriot!
Report This As A Bad Post Add To Your Ignored User List
Been there, done that in my day job. I do a lot of code review and regression testing when I have time...not all that often these days. I use the executive management line: "We've decided that we accept the risk and will move ahead." It usually works out ok...usually.

----------
Enjoy your stay in Clown World!
Abelardlindsey
Posts: 484
Incept: 2021-03-26

Report This As A Bad Post Add To Your Ignored User List
"C" is the foundational language of programming, with C++ as the object-oriented extension of it. One of the problems with the new languages (Java, Python, etc.) is that they are interpreted languages. This means they are slow and not deterministic.

I don't do this kind of programming. I do the PLC stuff like ladder and function block diagrams and the like. The closest I come to this is structured text. Unlike PC's, PLC's are deterministic (real time) which is what their purpose is.

My impression is PC software quality peaked around 2010, with a slow decline since then. The exception are the development tools I use for PLC (Studio 500, TIA Portal, Sysmac Studio) and SCADA programming. These continue to improve.

I like being in industrial automation and not IT.

----------
It's all in the mitochondria.
No liability, No mandates
Obseedian
Posts: 14314
Incept: 2007-07-26

Diversitopia
Report This As A Bad Post Add To Your Ignored User List
Time to go back to those trusty 286s. Hey, if they can fly a 737-MAX, they can run a house too, right? Oh wait...

Seriously though, frameworks and GC languages like Java and C# exist to make it "easy" for any monkey to become a "developer", which is great for corporations as it suppresses wages a lot. The fact that such people turn out utter garbage with those tools seem to concern nobody. As KD alluded to, GC is a huge ****ing performance drain. At work I had to write a program to process a ****ton of database records and write results back out. Well guess what, the code spends 40% of its time in the garbage collector. Every ****ing string is dynamically allocated. Yes, I could probably optimize by preallocating memory for records and use fixed buffers but in C# it's a ******n pain in the ass and makes the code HARDER to read which is kind of important if you go back 1 year after to make changes. Yes, there is stuff like unsafe code and manual memory allocation but then I might as well use C and it will be faster too.

----------
Those who vote decide nothing. Those who count the vote decide everything. - Joseph Stalin
Drole
Posts: 103
Incept: 2015-11-17

Report This As A Bad Post Add To Your Ignored User List
Been meaning to post a thank you for awhile.....

Maybe the next gen in my HH will know what all this means.




Inline
Dagge
Posts: 98
Incept: 2008-05-16

Tilton, NH
Report This As A Bad Post Add To Your Ignored User List
Object-orientedness doesn't (shouldn't) need to be a language thing. X11 was very objecty before C++ ever saw the light of day. Or look at the kernel source for Linux of BSDs, objects all over the place where you need them and wayyyy nicer to debug than C++ code.

I do enjoy the convenience of high-level languages though, but those should be used appropriately and anything performance-related should be done in C/asm (or use both, which for something like python & C is easy, and necessary if you need to get around the GIL).

The interpretedness of higher-level languages isn't that much of an issue these days since they get JIT compiled and in some cases can get better performance without additional work than C/ASM. The main performance benefit of low-level languages comes from them forcing you to think about what you're really doing.
Tickerguy
Posts: 176905
Incept: 2007-06-26
A True American Patriot!
Report This As A Bad Post Add To Your Ignored User List
@Dagge -
Quote:
The main performance benefit of low-level languages comes from them forcing you to think about what you're really doing.

WELL DUH!

That's the entire point: If you THINK about what you're doing then the structure of the data you are working with is better-optimized and thus you don't do STUPID THINGS.

That a compiler/HLL/whatever compiles JIT or not isn't the issue. The issue is that expecting the language to cover up for ****ing stupid DOES make it possible for incompetent people to write code, but exacts both a serious performance impact AND runs the risk of masking bugs that down the road can screw you up the ass when they get UNCOVERED by some future version of the runtime or simply because the so-called "internal protections" fail. If you don't try to rely on that then YOU have to do the work and guess what -- the odds of that sort of "**** you" go WAY down.

----------
I don't give a flying **** if you're offended.
Obseedian
Posts: 14314
Incept: 2007-07-26

Diversitopia
Report This As A Bad Post Add To Your Ignored User List
Torvalds had a hilarious rant against C++ some time ago. It gets funnier every time I read it.

http://harmful.cat-v.org/software/c++/li....


----------
Those who vote decide nothing. Those who count the vote decide everything. - Joseph Stalin
Login Register Top Blog Top Blog Topics FAQ
Showing Page 1 of 2  First12Last