[Tutor] Application Error after end of program

dman dsh8290@rit.edu
Mon, 10 Dec 2001 14:38:53 -0500


On Mon, Dec 10, 2001 at 01:46:49PM -0500, Lee-Shanok, Bruce wrote:
| Hello all,
| 
| 	I'm currently running Python (ActiveState 2.1.1, build 212), on
| Windows 2000. Now, I've written a program that used to run fine from
| beginning to end, and I recently started making use of the random and thread
| libraries... associated with this is an unusual error. Unusual in the sense
| that it occurs sometime after the very last line of code (a print
| statement). 

Once you make a (new) thread, it is as if you have two programs
running at the same time, but they share the same address space.  If
the "main" thread terminates (after that "last print" you mention) but
you have another non-daemon thread running, it keeps running.  The
program isn't over yet.

| Otherwise it's your generic sort of "The instruction at "<some hex address>"
| referenced memory at "<some hex address>" the memory could not be written.
| 
| Going into more detail with a debug gives me the fact that it's an
| "Unhandled exception in python (NTDLL.DLL): 0xC0000005: Access Violation.
| and a bunch of assembly I couldn't read to save my live.

Heh, NTDLL.DLL?  Sounds to me like a (buggy!) system library.  On a
non-buggy system (or at least, less so) errors only happen in
applications, not in the system itself.  I don't know what's going on,
but I expect it is thread related.

Can you get a core file in windows?  If so you can look at the
backtrace to see where (in the C/C++ part of the system) the error
occurred.  Ideally you can work backwards from there to the portion(s)
of your code that might initiate those operations, then use the
"print" technique to debug it.

-D

-- 

Religion that God our Father accepts as pure and faultless is this: to
look after orphans and widows in their distress and to keep oneself from
being polluted by the world.
        James 1:27