[Python-Dev] MS CRT crashing:

Tim Peters tim.one@home.com
Fri, 19 Jan 2001 19:04:10 -0500


[Guido]
> I'd just like to note for the record that this is exactly what I had
> predicted.

I would have hoped you'd be content to let the record speak for itself
<wink>.

> I'd also like to note that I *agree*.

With what?  That the program is undefined by the C std was never in dispute.

> Tim seems to think there's a race condition in the threading code,
> but it's really much simpler than that: the same bug can easily be
> provoked with a single-threaded program: just randomly read and
> write alternatingly.

And this is a point in their favor?!  "It's OK that the MT library corrupts
itself, because even the single-threaded library does"?

> So obviously the people who wrote the threading code aren't interested
> in the bug,

I don't know that it ever got as far as the people who wrote the threading
code, but I sure doubt it:  when the reply starts "Turns out the C standard
explicitly says  ...", it strongly suggests it was written by someone who
didn't already know what the C std says, and went looking for an excuse to
get it off their plate without further effort.  Par for the course, if so.

> because it's not in their code -- and the people who wrote the code
> that doesn't behave well when abused are protected by the C standard...

The behavior of things designated "undefined" and "implementation-defined"
by the std fall under "quality of implementation".  In the real world, the
latter is what vendors compete on; meeting the letter of the std is a bare
minimum for playing the game at all.

The plain fact is that their library is less robust than others in this
case.  I worked on a multithreaded stdio implementation at KSR, and that
sure couldn't corrupt itself.  Looks like no flavor of Linux does either.
It's not *reasonable* for a library to corrupt itself in this case, although
it's certainly reasonable for its behavior to vary from run to run.  There's
nothing in the C std that says a conforming implementation can't *crash* on
the program

void main() {int i = 1;}

either <wink>.

a-std-is-a-floor-on-acceptable-behavior-not-a-ceiling-ly y'rs  - tim