HNHacker News
TopNewBestAskShowJobs

Avernar

397 karma · joined November 5, 2014

submissionscomments
Avernar··on Medical Equipment Crashes During Heart Procedure Because of Antivirus Scan
> The easiest way to be sure a code path will run properly is to avoid writing it in the first place.

Agreed. So the app shouldn't contain anything extra not related to it's primary function.

However, handling error conditions reported by the operating trumps the extraneous code rule. But there are many ways to handle an error, including ignoring it if that's the proper thing to do.

Crashing is never the proper thing to do. If the program had simply exited at the very minimum, a restart would have taken a lot less time than a complete reboot of the machine. The software crashed that badly that it required a reboot of the machine.

> Why is nobody questioning the propriety of using an off-the-shelf Windows PC in safety-of-life applications?

They are, in the other threads. But using a better OS for the task wouldn't prevent the coding error the programmer did.

Let's say they chose Linux. A signal goes off or something else happens and their read call fails. Since they expect all their I/O to succeed they crash just like the Windows box.

If they bothered to handle the error and check for EINTR they'd know it was interrupted and not a hardware failure.

My point is, changing operating systems doesn't protect you from poorly coded applications.

Avernar··on Medical Equipment Crashes During Heart Procedure Because of Antivirus Scan
> In that scenario, your surgeon would see the program suddenly freeze.

Only if the programmer or his management were incompetent. The display routine should be running on a separate thread than the processing code. No whole program freeze should occur.

As for displaying random data, why would the programmer want to do this? Either display nothing or the last readings WITH a message that it's not real time.

It's not the same as a crash! A crash requires 5 minutes minimum guaranteed. Restarting instantly after telemetry returns can happen under a second in the best case which can be the difference between a live and dead patient.

> If your environment fails, there's nothing you can do to recover. Planes aren't designed to survive the loss of a wing. Why is this case any different?

There are different kinds of failure. Permanent and transient. Following the permanent procedure for a transient case can be fatal.

Take your airplane example. Loss of a wing is permanent. That would be like the CPU failing or an external cable being cut.

But your engines shutting down can be permanent or transient. Just like disk I/O failing. You'd use the transient procedure in this case. Keep trying to restart the engines. If they restart, great! You've just saved the plane.

Same with the disk I/O. The programmer should keep trying to restart the I/O. If it comes back, great! You've just saved the patient.

Avernar··on Medical Equipment Crashes During Heart Procedure Because of Antivirus Scan
Yes it does! Showing "no telemetry available" is exactly what it should do. Crashing = unreliable. Reporting an error condition = reliable.

Immediately? Took them 5 minutes to reboot the computer. The scan of the folder would take seconds let alone minutes. Pinpointing the problem is secondary. Not killing the patient is primary.

> If the program's sole purpose is to transform a massive amount of data in real time, it must have disk access by definition. It can't not have disk access.

And that is the mind set the programmers of the software had. You have to take care of error conditions. The processing can't have no disk access but no disk access can occur temporarily or permanently. What can you do? Pause the processing part of your program. Or make the processing part treat "no data" as valid input and display something else.

Imagine taking that viewpoint with an ECG machine: This machine displays a heart rate waveform. So it must have a heart rate input. If there is no heart rate we'll just crash requiring a 5 minute reboot.

Hell no! Draw a straight line and set off a buzzer!

Avernar··on Medical Equipment Crashes During Heart Procedure Because of Antivirus Scan
The disk did not fail. An I/O operation failed. The first is a permanent condition, the second can be permanent or transient. Big difference.

In Linux a signal can cause an I/O to fail. In Windows it's antivirus and other background tasks can cause I/O to fail.

What can it do to recover? Retry the I/O operation! It should keep trying until the operator tells it to stop.

Avernar··on Medical Equipment Crashes During Heart Procedure Because of Antivirus Scan
> When the disk is plugged back in, it should be able to restart without any problems. But I think that's a different kind of resiliency than what you're referring to.

Yes and no. I was referring to restarting internally when the error condition went away but restarting the app and waiting for telemetry to return can be a valid solution.

Think of your torrent software. If you crank your firewall to block it while it's running it will not crash. If your disk fills up it won't crash. When the network comes back or more drive space if freed it will restart it's internal mechanisms. You wouldn't want it to restart in these conditions. If it runs out of memory however choosing to exit might be the best recovery mechanism.

I think a life critical medical application can at least strive for internal restart and do an external restart if all else failed. The article stated they had to reboot the machine to get it back. Now that's way worse.

> The situation in the article seems closer to hardware failure than a design oversight.

Hardware failure is almost always a permanent condition. This was a "my I/O stopped briefly and would have came back if my code could handle it".

Avernar··on Medical Equipment Crashes During Heart Procedure Because of Antivirus Scan
"Merge says the antivirus froze access to crucial data acquired during the heart catheterization. Unable to access real-time data, the app crashed spectacularly.

The company claims that they included proper instructions in their documentation, advising companies to whitelist Merge Hemo's folders in order to prevent crashes from happening, so it seems that the whole incident was nothing more than an oversight on the medical unit's side."

Here's how I read that: The programmers of this piece of software assumed that some I/O operation would never fail and when it does the program shits itself. So instead of hardening their software to withstand loss of telemetry gracefully, which would cost time and money for the company, they just give instructions to disable scans on their folder.

Odds are good that somewhere this scan will happen (and it did). Either IT doesn't read the release notes or goofs the configuration or an antivirus update clears the white list. Might not even be the antivirus that interferes with the telemetry briefly.

But instead of having resilient software it's "the anitvirus software's fault" or "it's IT's fault" when something goes wrong because of their bad management/engineering decision.

Avernar··on Who Invented Homework?
Massive amounts of homework is the perfect training for future work in North America. When kids get used to doing 60-80 hours worth of schoolwork for the same education that can be done in 40 hours they won't complain when their future boss demands 60-80 hours of work for the pay of 40 hours.
Avernar··on Three-quarters of drivers don't want to own an autonomous car
I agree. Having a vehicle that requires me to take over in an emergency defeats the whole point of a driverless vehicle. I'd just rater drive myself then as I prefer to be a driver and not a passenger.

Basically there should be two modes. Full auto when I'm too tired to drive (or sleeping) and semi auto where it takes over in an emergency. And a third mode of full manual for off roading.

Avernar··on Atari co-founder: mobile games make me want to throw my phone
My friends and I play Clash Royal, Clash of Clans and Boom Beach. Out of the three it's Clash Royal that has made us come this close to smashing our tablets in rage.

But it's not the IAP that's the cause. It's the skewed matchmaking and the mysterious loosing streaks that occur very frequently. You'd be playing and winning some and loosing some and then all of a sudden you hit a losing streak of 6-12 losses or more.

One thing for sure is my friends and I are not spending a penny on this game because of that regular frustration. We've spent a little on the other two games to get past a point of tedium but that gave us something concrete.

In Clash Royal spending money just gives you a chance to get the cards you need. No thank you. If the game mechanic wasn't so addictive we'd have stopped playing it long ago.

Avernar··on Why volatile is hard to specify and implement
We're into semantics here. Portable requiring a CPU shim vs portable not requiring one. More complicated cpu/bus interfaces require the first one but if you can just use volatile for IO as done in embedded work you get much smaller and/or faster code.

If a device has registers that are sensitive to multiple read/writes of the same address and ones that need caching and write combining for performance in the same 4K page then it was designed poorly. :)

PCI bridges need to support legacy mode. Otherwise DOS programs and drivers wouldn't run correctly. The BIOS sets up a compatibility MTRR setup for this reason and you can see the Linux kernel print it out on boot.

So I'm basically agreeing and disagreeing with you on this one. Once the hardware gets past a certain complexity you need to move from volatile to accessor functions/macros.

Avernar··on Why volatile is hard to specify and implement
If you do it correctly it should work. I'm curious if that code is running on a multi core (or even hyperthreaded) CPU.
Avernar··on Why volatile is hard to specify and implement
Yes, you are correct that there are two issues. But solving 2 may solve 1 automatically or just need the compiler barrier intrinsics in the same spots as the processor barrier intrinsics.

And yes, the first issue can be fixed with memory barriers. If you put a compiler+processor read barrier in front of the first line that reads the shared variable the compiler will re-read it from memory back into a register. After that it will use the register as to not kill performance until it hits the barrier again.

Avernar··on Why volatile is hard to specify and implement
Why would you need to alias pointers for MMIO? There's one pointer to a struct that defines all your IO registers for that memory range.
Avernar··on Why volatile is hard to specify and implement
Yes, you can use memory barriers for MMIO but you'd have to put them between every single statement that touches the MMIO address range. Not only will that bloat your code it would slow down access to all your regular variables as the compiler would have to reload everything constantly and the processor wouldn't be able to out of order anything.

Why do you think volatile won't work for MMIO with the proper MTRR/PAT setup? The volatile keeps the compiler for messing with the read/writes and the MTRR/PAT makes the processor perform all reads and writes exactly in the order the instructions tell it to without any caching or write combining.

"This is more complicated than just doing the access from assembly." and "It's also not something you can rely on if you want to write portable code." So in one paragraph you're telling me to do it in assembly and in another you want portable code.

The linux kernel has gone above and beyond using volatile but in embedded it's how IO is done when using C.

Avernar··on Why volatile is hard to specify and implement
Volatile is for memory mapped IO. Some processors may need extra instuctions or configuration but that doesn't replace the need for volatile with MMIO.

On x86 the MTTR/PAT mechanisms is what disables caching, write combining and enables write through to MMIO address ranges.

Avernar··on Why volatile is hard to specify and implement
Wasn't me either. Can't downvote yet. :)

Did some more research. Compilers have their own intrinsics that only affect the code generated (in addition to the processor ones). VS has _ReadBarrier, _WriteBarrier and _ReadWriteBarrier while GCC has asm volatile("" ::: "memory"); to prevent reordering optimizations.

There really isn't any difference between multithread with common processes memory and multiprocess with mmaped shared memory. Both have mutliple threads accessing the same physical memory but in one case the OS made the memory common and the other you made the memory common.

BTW, when I say multithreaded I'm talking real threads and not light/green/cooperative/fake/whatever threads.

Avernar··on Why volatile is hard to specify and implement
There are many types of barriers depending on the processor architecture. They're usually used in pairs so for example a read barrier would be used when mutex is acquired and the a write barrier when it's released.

If the compiler is smart about its memory barrier intrinsics it will make sure to reread anything after the read barrier and write everything before the write barrier. This will speed things up by not having to use volatile. Between the barriers it can cache reads and inside registers and optimize out multiple writes like normal.

If the compiler can't do that then you need to use volatile. Volatile was meant for I/O where every read has to hit the bus. So if you're forced to use it then you just copy the volatile variable into a non volatile one for use inside your mutex to get some speed back.

Avernar··on Why volatile is hard to specify and implement
Yes, I read your comment. :) What I was saying is that when you're using shared memory to talk to another thread or process (which by definition is running on another thread) you need to use memory barriers or the processor may do the same optimizations (and more) that your compiler did. On top of that other cores may not see your read/writes.

Debug mode tends to always work because it writes code as if everything was effectively volatile. After that it depends on how the threads/processes are scheduled on what core. Without proper synchronization it may work, may work slowly, may not work once in a blue moon or fail all the time. Current processor may run it fine and then it may stop working on future processors.

Fortunatly if you use things like mutexes then the barriers are handled for you.

Depends on the compiler if the barier intrinsics need volatile. I'll have to do some research on that.

Avernar··on Why volatile is hard to specify and implement
Volatile only affects how the compiler handles memory access. It does not tell the processor anything at all. The processor is still free to reorder reads and writes. You need to use the fence and lock instructions to create memory barriers especially on multi core processors.
Avernar··on 'Devastating' bug pops secure doors at airports, hospitals
The maglocks we installed had a field sensor that measured the bond strength. The LED on the maglock would turn red when powered and then turn green when the bond strenght was correct.

Even a tiny piece of paper would keep the LED from going green. Same with a slightly misaligned plate on the door. Pain in the ass since our controllers would not show the door secure until it was perfect.

Avernar··on Let Me Get That Door for You: Remote Root Vulnerability in HID Door Controllers
There were secure alternatives available several years ago. Unfortunately the industry is moving from code running on bare metal to having the main panels and now the door controllers run a full embedded OS. The complexity of how everthing interacts now has increased exponentialy so your attack surface is now much larger. All for easier initial development.
Avernar··on Stargate Physics 101: A comedy about the importance of software testing
> It is also worth noting that earth in the show built their own DHD which presumably would have different computer limitations than the ancient built DHD

The gate itself has control crystals as you can dial out without a DHD if you just give it power and some elbow grease. The 38 minute cutoff is probably in that code.

They must have run out of code space in the gate and had to offload some of the code to the DHD. :D The correlative update routine for the coordinate system is in the DHD for example so the earth gate could originally only dial Abydos until they added that to their homebrew DHD.

Avernar··on FTP Must die the technical explanation
I loved the active/passive mode feature of FTP back before getting broadband. I had an FTP client that would put one server in active mode and one server in passive mode and transfer files directly between them with only status messages going down my 9600 baud connection.
Avernar··on Base Ten for Almost Everything
Using the ibi/ebi notation is fine when it is written, especially when you have base 2 and 10 in the same document.

Speaking it however makes you sound like you have a speach impediment and non geeks will think your're a moron. You can deduce the base of the unit from context most of the time and when you can't, unlike when reading, I can ask you for clarification right away.

Avernar··on Base Ten for Almost Everything
> Frequencies are irrelevant.

No they're not. They're very relavent for anything dealing with networkig and communications.

I recently programmed an atmega chip for a homebrew project and the frequency of the SPI bus was very relavent.

Avernar··on Base Ten for Almost Everything
> thumb drive capacities

I don't recall ever seeing a thumb drive advertised base 10. Have you seen base 10 for thumb drives often?

Avernar··on Base Ten for Almost Everything
I grew up with computers so tinking binary is not an issue for me. Storage capacity has always been wierd. A 1.44MB floppy actually has 2,880 512byte sectors. Base 2 and base 10 in the same measurement!
Avernar··on Base Ten for Almost Everything
Compact Flash, SD, thumb drives are all advertised base 2. SSD are advertised usually base 10 but I've seen some advertised base 2. No consistency. But that's marketing for you.
Avernar··on Base Ten for Almost Everything
I personally prefer base 2 units for file size. A 2GB file will take 2GB of memory when I load it in. Hard drive page sizes are also base two, 512 bytes for most drives and 4096 bytes (4K) for newer large capacity drives.

I also prefer base 2 for file transfer speeds just so it matches the file size convention. Fortunately most programs either default to base 2 or let you chose in the preferences.

Network line speeds are in base 10 (100Mbit ethernet is actually 100,000,000 bits/s) but there so much protocol overhead and other factors that comparing transfer speeds and line speeds is moot in most situations.

Avernar··on Base Ten for Almost Everything
Flash drives are base 2. The memory chips inside are base 2 capacity. The flash control chip just reserves some space for wear leveling and other internal functions.
← PreviousPage 7 of 9Next →