Re: why panic(9) ?

From: Martin Sugioarto <martin_at_sugioarto.com>
Date: Wed, 12 Jan 2011 08:10:00 +0100
Am Tue, 11 Jan 2011 22:11:13 +0100
schrieb David DEMELIER <demelier.david_at_gmail.com>:

Hi David,

I want to say something to the two statements below.

> In fact I like FreeBSD, and I don't expect running anything else. But
> I must say that I didnt see windows 2000 crashing on my every boxes I
> have before switching to FreeBSD.

From my experience, when FreeBSD crashes, it means mostly that you have
some defective hardware. Last time when I had regular panics, it was a
Xeon CPU that was broken and flipped some bits in its cache when it got
a bit hotter.

The point is... this kind of errors would never be discovered by
MS-Windows. Because it appears to crash from various reasons and you
never know if you have hardware problems or a programming error. Then
it's also normal that applications on MS-Windows crash here and there.
It's mostly ignored because the whole system is not stable. I've had
also MS-Windows 2000 long time ago. And it ran on a PC where CPU had
wrong frequency multiplicator setting (all the time!). No one complained
when it crashed. But when I tried to run a Linux Live-CD on it, it
panic'ed very soon (mostly when starting). I suspect that MS-Windows
has a few routines which ignore errors and tries to continue... which
is very bad, in my opinion!

It is really annoying to hear people saying "MS-Windows runs and
FreeBSD crashes", because it means to me that FreeBSD discovered
another hardware error where MS-Windows failed.

(Btw, I changed the CPU a year ago and now it works without panics.
Also the wrong multiplicator was corrected and the AMD K5 CPU ran
correctly.)

> I understand everything, corrupts kernel data must not be used. That's
> why panic are made to prevent any dangerous things.
 
Yes. No one wants to lose data.

I don't want to say that FreeBSD does not have programming errors. Of
course, a panic might be triggered by an unknown situation in a driver.
But you have to figure it out somehow, where the origins of the error
are.

And that's why a panic helps here. The kernel shows you the NEAREST
POSSIBLE position where it detected that something went wrong. Panics
are also good for diagnosis.
 
But also, you want to get the errors in FreeBSD fixed. I learned that
when I insert assertions (see assert(3)) and let my applications crash
intentionally when it detects an error, paradoxically the applications
have far less errors than the ones that try to run as far as possible.

First thing is, as I said before, you discover the programming error
NEAR the place it happened (easier to fix). Second, sometimes (after
years) a developer forgets what assertions he made to restrict the
usage of certain routines (special cases/values are the worst things
here). It reminds the developer quickly when doing basic tests
(regression tests e.g.).

But as I said, I would say that FreeBSD does not panic often. Look
first if it's a hardware error (and these PC-DOCTOR applications cannot
really discover any problems, I can tell you for sure; also memcheckers
do not find errors in memory except for some trivial cases).

The best test is to try to compile world on FreeBSD. When a PC survives
this, it's functioning well (very probable).

Then, think if you use any exotic hardware on your system. Some drivers
which are not very common, might not cover every vendor or are still
not tested well, because there are not many people who use them.

All in all, Panics are important. They show you problems, try to give
hints what happened that lead to this situation and save you from
subsequent data disasters, as others pointed out.

--
Martin

Received on Wed Jan 12 2011 - 06:36:52 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:10 UTC