[Python-bugs-list] [ python-Bugs-766669 ] Consistent GPF on exit

SourceForge.net noreply@sourceforge.net
Sun, 06 Jul 2003 09:34:15 -0700


Bugs item #766669, was opened at 2003-07-06 08:32
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=766669&group_id=5470

Category: Windows
Group: Python 2.2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Kurt Grittner (grittkmg)
>Assigned to: Nobody/Anonymous (nobody)
Summary: Consistent GPF on exit

Initial Comment:
Using the following script (clt.py):

import os, time, sys
from socket import *              
from Tkinter import *

class App:
    def __init__(self, master):
        self.win = Toplevel(master)
        self.button = Button(self.win, text="QUIT", 
fg="red", command=self.goaway)
        self.button.pack(side=LEFT)
        self.hi_there = Button(self.win, text="Hello", 
command=self.say_hi)
        self.hi_there.pack(side=LEFT)
        #self.serverHost = 'localhost'      
        self.serverHost = '192.168.1.12'      
        self.serverPort = 50007            
        self.sockobj = socket(AF_INET, SOCK_STREAM)      
        self.sockobj.connect((self.serverHost, self.
serverPort))   

    def say_hi(self):
        self.message = ['Hello network world']   
        for line in self.message:
            self.sockobj.send(line)  
        data = self.sockobj.recv(1024)
        print 'Client received:', `data`

    def goaway(self):
        self.sockobj.shutdown(0)
        self.sockobj.close()
        self.win.destroy()

def NewClient():
	App(root)

def PgmExit():
	root.quit()
    
root = Tk()
Button(root, text='New Client', command=NewClient).
pack()
Button(root, text='Quit All Clients', command=PgmExit).
pack()
root.mainloop()

If you press 'Quit' first, then there are no errors.

If you press 'New Client' even once (whether or not there 
is an echo server to talk to) the program runs the other 
Toplevel windows seemingly without problems, but then 
when you press 'Quit' you die in the following place :

/* Vc98\Crt\Src\Crtexe.c */

#ifdef WPRFLAG
            __winitenv = envp;
            mainret = wmain(argc, argv, envp);
#else  /* WPRFLAG */
            __initenv = envp;
            mainret = main(argc, argv, envp);
#endif  /* WPRFLAG */

#endif  /* _WINMAIN_ */

/* 
-------------------------------------------------------
----------------- */
/* Error executing following line */
            exit(mainret);
/* 
-------------------------------------------------------
----------------- */

/* OS error dump
PYTHON_D caused an invalid page fault in
module KERNEL32.DLL at 017f:bff88396.
Registers:
EAX=c00309c4 CS=017f EIP=bff88396 EFLGS=00210216
EBX=0062ffec SS=0187 ESP=0052fecc EBP=00530044
ECX=00000000 DS=0187 ESI=00000000 FS=10e7
EDX=bff76855 ES=0187 EDI=bff79060 GS=0000
Bytes at CS:EIP:
53 56 57 8b 75 10 8b 38 33 db 85 f6 75 2d 8d b5 
Stack dump:

/* Vc98\Crt\Src\Crt0dat.c */
/* First debug run */
1020ACE0   jmp         doexit+0B6h (1020acf6)
384:          }
385:
386:
387:          _C_Exit_Done = TRUE;
1020ACE2   mov         dword ptr [__C_Exit_Done 
(10264728)],1
388:
389:          ExitProcess(code);
1020ACEC   mov         ecx,dword ptr [code]
1020ACEF   push        ecx

/* 
-------------------------------------------------------
----------------- */
/* Error on the following call */
1020ACF0   call        dword ptr [__imp__ExitProcess@4 
(10256020)]
/* 
-------------------------------------------------------
----------------- */

/* Second debug run */
PYTHON_D caused an invalid page fault in
module KERNEL32.DLL at 017f:bff88396.
Registers:
EAX=c00309c4 CS=017f EIP=bff88396 EFLGS=00210216
EBX=0062ffec SS=0187 ESP=0052fecc EBP=00530044
ECX=00000000 DS=0187 ESI=00000000 FS=1b3f
EDX=bff76855 ES=0187 EDI=bff79060 GS=0000
Bytes at CS:EIP:
53 56 57 8b 75 10 8b 38 33 db 85 f6 75 2d 8d b5 
Stack dump:


390:
391:
392:  }
1020ACF6   mov         esp,ebp
1020ACF8   pop         ebp
1020ACF9   ret

/* Vc98\Crt\Src\Crtexe.c - Continued */

*/

        }
        __except ( _XcptFilter(GetExceptionCode(), 
GetExceptionInformation()) )
        {
            /*
             * Should never reach here
             */
            _exit( GetExceptionCode() );

        } /* end of try - except */

}

It seems weird that everything else in the program works 
fine right up to ExitProcess.  The error occurs on multiple 
windows machines.  The error does NOT occur on linux 
running the same code base.  Also, many other 
multi-threaded sample programs from other authors 
exhibit the same 'crash on exit' syndrome.

Thanks for your attention,
Kurt


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2003-07-06 12:34

Message:
Logged In: YES 
user_id=31435

Unassigned.  Didn't see any problem on Win98SE, under 2.2.3 
or 2.3b2, using either of the self.serverHost assignments.

If you can, please try under 2.3b2.  On Windows that ships 
with the current version of Tcl/Tk (8.4.3), and some kinds of 
Tcl/Tk Windows shutdown races are said to be fixed in 8.4.3.

Question:  How do you start this program?  With python.exe 
or with pythonw.exe?  The only known workaround for some 
kinds of previous Tcl/Tk shutdown races was to start the 
program with pythonw.exe.  So if you haven't tried 
pythonw.exe, try it and see whether the problem goes away.  
If it does, it's almost certainly a bug in Tcl/Tk.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=766669&group_id=5470