Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
Plug In an UPS and Get a Program Crash

Plug In an UPS and Get a Program Crash

Aug 29 2013
Author:

After publishing the article "Grounded Pointers", a lot of people commented on it. Among other things, they mentioned that various devices are often shipped with extremely poor software. And that gets on nerves quite a bit sometimes. However, I'm not going to grumble about that. Instead, I'd like to tell you a funny story to the point.

I was a student then and worked as a programmer in one firm. Its field was computer simulation. We developed software packages designed to compute various parameters as well as data visualizers.

Now the story itself. One day I was sitting and writing some code as usual. Here, a physicist colleague of mine appears from his cabin and approaches me. And he has that strange expression and odd smile on his face. Now he gets serious and says, "Your wonderful app "ABCD" suggests that I contact the manufacturer - so here I am".

That's it. I see what he means. When a program crashes, it displays a message in the "Please contact manufacturer" style. Since I am one of the developers of "ABCD", he has come for me. But what does that strange smile mean and why not simply report the bug in the bugtracker? Without much thinking about it, I stand up and follow him.

A common sight: a crash report window. Big deal! No, don't think it crashes every 5 minutes; but there's nothing to wonder at, too. I ask, "What've you done?"

He smiles widely, and the following dialogue takes place:

"I've plugged my computer to a new UPS [uninterruptable power supply]. The program won't run after that - it crashes at launch."

"H'm... What else?"

"Nothing."

"Ha-ha. Oh yeah, sure! So, it had worked before you plugged in the UPS and now it doesn't."

An even wider smile spreads over my colleague's face:

"That's it! Look, I'll show you a trick."

He turns off the computer, crawls under the desk, rustles there for a while, unplugging the UPS power cable and plugging in the ordinary mains power cable. Then he turns on the computer, runs our program - it works well.

Then he again turns off the computer, crawls under the desk and plugs in the UPS power cable back. He turns on the computer and, now smiling as hell, runs the program - it crashes right after the start!

I was shocked. You know, never in my life I've been so much confused when dealing with computers.

It all cleared up pretty soon, of course. And I'll tell you about that - the reason was awfully trivial.

But it was at that moment that I doubted my understanding of the computer's operation principles and basic laws of physics. The joke about bits being deformed in a cable seemed not that much a joke to me then.

That must have been the strongest impression a computer has ever made on me. Don't even know what to compare it to. Perhaps I felt something similar when experimenting with the Apogei BK-01 computer and discovering that I could control it by simply moving my hand close to it. You could read and process the random noise from the input/output ports (don't remember how to call them properly) not connected to anything.

I'm not sure I can express my feelings at that moment in words. Try to imagine a situation when an application you are well familiar with runs well on the mains power and crashes when running on an UPS.

It turned out to be pretty simple, though. It was not some magic voltage drop caused by a defective UPS. Neither was it deformed bits.

Poor software was the reason for that magic and my astonishment. And also my colleague appeared a nasty guy, for he had at first concealed one important thing finding it irrelevant.

It was not only the UPS plugged to the computer. It shipped together with a disk with software and a USB cable to connect it to the computer. The app from the disk allowed you to perform various tasks. For example, you could click on its icon in Systray and view the battery charge. What's important, my colleague had installed that app too - just for the sake of it.

The consequences were fatal. That marvelous app, messing around in Systray, knocked out not only our program, but - as we found out later - many other applications as well. How did it manage to do that? Ha, shit coders can do much more than that!

Investigations of the reasons for the crash revealed that the OpenGL subsystem had been broken. But our program didn't use OpenGL too much. Other OpenGL programs were broken too. For example, Quake stopped working - or was it some other shooter? I don't remember now. Yeah, sometimes we spent our after-work time shooting each other in the virtual world. Aren't all students like that?

For some reason this shit-app for the UPS exploited OpenGL when drawing a nice round diagram of the battery charge percent. Moreover, it did it very unceremoniously: after being launched, it consumed all the OpenGL resources. It resulted in OpenGL being used by this monitor app alone, while leaving a fat lot for others. It didn't matter if you were viewing its beautiful picture or not - all the resources were already exhausted. It's been much time since then, so I don't remember what it did in particular. But the general tactics was the following. It kept creating some OpenGL objects without freeing them. Those objects ran out at one instant, but the app didn't give a damn. It itself was running perfectly well, while other programs could not create an object for themselves - they got an error status instead of descriptors.

The problem disappeared when turning off the UPS with its USB cable still connected to the computer. I guess the app worked somehow differently when it stopped seeing the UPS. It was that very mechanism my colleague had demonstrated me, shaking my sense of reality.

That accident has resulted in us creating a more thorough diagnostic of such errors by our tool and rejecting the "marvel-monster-app" visualizing the UPS's state.

That's a good example of awful software devices sometimes come shipped with.

Popular related articles


Comments (0)

Next comments next comments
close comment form