Subject: shutdown(8) Heisenbug?
To: None <current-users@netbsd.org>
From: Mason Loring Bliss <mason@acheron.middleboro.ma.us>
List: current-users
Date: 09/28/1999 22:59:39
Hi, all.

I've been noticing really weird behaviour for a while now, and I've finally
tracked it down, at least as far as I can track it.

For a while now, up to and including a sup and build this past Sunday, I've
had my machine essentially hang at shutdown time. It takes forever to sync
the disks, and after the sync message the machine never reboots at all - it
just hangs, and on reboot my root partition (but not my other partitions)
is run through fsck for cleaning.

What I found is this, and it's very strange.

shutdown(8) consistently does a fast shutdown. Or, at least, it fails to run
rc.shutdown. It seems that the statically-defined global int "dofast" is non-
zero when it's checked inside of die_you_gravy_sucking_pig_dog(). Both the
specs I've read and the way it's used inside shutdown(8) indicate that static
variables are initialized to zero, but this isn't acting that way.

I'm calling this a Heisenbug because, true to form, if I spit out the value
of "dofast" before the fastboot check and then exit, it shows up a zero. I'm
hoping this isn't a code generation bug or something evil. (I've tried it
with the declaration "dofast=0" to no avail, incidentally, and I believe I
tried it without the standard -O2, also to no avail, but I didn't take notes
and I don't remember clearly enough to make it not worth trying that again.)

My immediate fix is to simply set "dofast" to zero at the beginning of main(),
but this shouldn't be necessary. "dofast" isn't used that many places, though,
and I've looked, so I'm not sure what could be running it over, if that is,
indeed, what's happening.

Has anyone else seen this, or is this yet another unique feature of my personal
environment? <grin>

Anyway, I'll try to nail this down a bit more. It's a bit painful to test it
in all its forms, but there's probably more I can check. Unfortunately, I can't
test it remotely, and remotely is where I have the time to do it. <sigh>

Thanks in advance for clues.

-- 
    Mason Loring Bliss  mason@acheron.middleboro.ma.us  They also surf who
awake ? sleep : dream;  http://acheron.ne.mediaone.net  only stand on waves.