Exception in Python 2.3.3 Interpreter

S

Saravanan

Hello,

Im running Python Application as a Windows Service (using windows
extensions). But, sporadically the application crashes (crash in
Python23.dll) and this stops the service. This problem cann't be
reproduced easily in my system and the call stack generated by the
application is given below.


Occurrence: 2005/4/22 23:24:57
Process Id: 3072
Process Name : D:\Python23\lib\site-packages\win32\PythonService.exe
Thread Id: 292
Exception code: C0000005 ACCESS_VIOLATION
Fault address: 1E05C202 01:0005B202 C:\WINDOWS\system32\python23.dll

Registers:
EAX:1E0E2EAC
EBX:00732EA8
ECX:1E03E500
EDX:016EC200
ESI:00000000
EDI:00732EA8
CS:EIP:001B:1E05C202
SS:ESP:0023:025FFA3C EBP:00637470
DS:0023 ES:0023 FS:003B GS:0000
Flags:00010246

Call stack:
Address Frame
1E05C202 00637470 0001:0005B202 C:\WINDOWS\system32\python23.dll
016EC29C 00000003 0000:00000000

The thread which throws the exception is from the Python-Core and not
from the application logic.

The above call stack points to PyObject_Compare function in object.c.

Any clue about the problem?

Thanks in Advance.

Saravanan D
 
S

Saravanan D

Hello,

The crash occured at the following line :

c = strcmp(vname, wname) (object.c)

Please note that the dump has been taken with the help of adplus.


# ChildEBP RetAddr Args to Child
00 023ffa58 1e05c6da 055b1250 00637470 00000000
python23!default_3way_compare(struct _object * v = 0x053f2bfc, struct
_object * w = 0x00000001)+0x102
[F:\Python-2.3.3\Python-2.3.3\Objects\object.c @ 689]
01 023ffa74 1e05c5ee 055b1250 00637470 00000000 python23!do_richcmp(struct
_object * v = 0x1e0b9fb8, struct _object * w = 0x00000000, int op = 0)+0x4a
02 023ffa94 1e0174d9 055b1250 00637470 00000000
python23!PyObject_RichCompare(struct _object * v = 0x053f2bfc, struct
_object * w = 0x00000001, int op = 0)+0x1ae
[F:\Python-2.3.3\Python-2.3.3\Objects\object.c @ 1044]
03 023ffaa4 1e013182 00000000 055b1250 00637470 python23!cmp_outcome(int op
= 88026108, struct _object * v = 0x00000001, struct _object * w =
0x00000000)+0xa9 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3880]
04 023ffb18 1e016ba4 014f3318 00000002 0099f170 python23!eval_frame(struct
_frame * f = 0x053f2bfc)+0x542 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c
@ 1965]
05 023ffb30 1e016a69 0099f170 023ffb7c 00000002
python23!fast_function(struct _object * func = <Memory access error>, struct
_object *** pp_stack = <Memory access error>, int n = <Memory access error>,
int na = <Memory access error>, int nk = <Memory access error>)+0x94
[F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3520]
06 023ffb5c 1e014b65 00a280d0 00000002 00000008
python23!call_function(struct _object *** pp_stack = 0x00000001, int oparg =
0)+0x159 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3458]
07 023ffbcc 1e016ba4 006ea160 00000001 0099f1b0 python23!eval_frame(struct
_frame * f = <Memory access error>)+0x1f25
[F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 2117]
08 023ffbe4 1e016a69 0099f1b0 023ffc30 00000001
python23!fast_function(struct _object * func = <Memory access error>, struct
_object *** pp_stack = <Memory access error>, int n = <Memory access error>,
int na = <Memory access error>, int nk = <Memory access error>)+0x94
[F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3520]
09 023ffc10 1e014b65 00a280d0 00000001 00000000
python23!call_function(struct _object *** pp_stack = 0x00000000, int oparg =
0)+0x159 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3458]
0a 023ffc80 1e015b6f 006cf6d0 00000000 00a1df9c python23!eval_frame(struct
_frame * f = <Memory access error>)+0x1f25
[F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 2117]
0b 023ffcac 1e040978 0096b720 00000001 006cf6d0
python23!PyEval_EvalCodeEx(struct PyCodeObject * co = <Memory access error>,
struct _object * globals = <Memory access error>, struct _object * locals =
<Memory access error>, struct _object ** args = <Memory access error>, int
argcount = <Memory access error>, struct _object ** kws = <Memory access
error>, int kwcount = <Memory access error>, struct _object ** defs =
<Memory access error>, int defcount = <Memory access error>, struct _object
* closure = <Memory access error>)+0x70f
[F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 2663]
0c 023ffcf0 1e0078ec 009788b0 00a1df90 00000000
python23!function_call(struct _object * func = 0x1e0baa50, struct _object *
arg = 0x0096b720, struct _object * kw = 0x00954390)+0x138
[F:\Python-2.3.3\Python-2.3.3\Objects\funcobject.c @ 512]
0d 023ffd04 1e01be03 009788b0 00a1df90 00000000
python23!PyObject_Call(struct _object * func = 0x1e0d7608, struct _object *
arg = 0x00000001, struct _object * kw = 0x00a280d0)+0x1c
[F:\Python-2.3.3\Python-2.3.3\Objects\abstract.c @ 1755]
0e 023fff24 1e0078ec 00a20f08 00671030 00000000
python23!instancemethod_call(struct _object * func = 0x1e0d7608, struct
_object * arg = 0x00000001, struct _object * kw = 0x00a280d0)+0x133
[F:\Python-2.3.3\Python-2.3.3\Objects\classobject.c @ 2433]
0f 023fff38 1e016827 00a20f08 00671030 00000000
python23!PyObject_Call(struct _object * func = 0x77e4a990, struct _object *
arg = 0x01415bd8, struct _object * kw = 0x00000000)+0x1c
[F:\Python-2.3.3\Python-2.3.3\Objects\abstract.c @ 1755]
10 023fff50 1e080c77 00a20f08 00671030 00000000
python23!PyEval_CallObjectWithKeywords(struct _object * func = 0x77e4a990,
struct _object * arg = 0x01415bd8, struct _object * kw = 0x00000000)+0xa7
[F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3346]
11 023fff70 1e080675 013d8ba0 00000000 014161a8 python23!t_bootstrap(void *
boot_raw = 0x77e4a990)+0x37
[F:\Python-2.3.3\Python-2.3.3\Modules\threadmodule.c @ 183]
12 023fff84 77bc90a2 0086f32c 00000000 00000000
python23!PyThread_get_thread_ident(void)+0x5
[F:\Python-2.3.3\Python-2.3.3\Python\thread_nt.h @ 213]
13 023fffb8 77e4a990 01415bd8 00000000 00000000 msvcrt!_endthread+0xa6
14 023fffec 00000000 77bc9032 01415bd8 00000000
kernel32!BaseThreadStart+0x34

- Saravanan D
 
F

Fredrik Lundh

Saravanan D said:
03 023ffaa4 1e013182 00000000 055b1250 00637470 python23!cmp_outcome(int op
= 88026108, struct _object * v = 0x00000001, struct _object * w =
0x00000000)+0xa9 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3880]
04 023ffb18 1e016ba4 014f3318 00000002 0099f170 python23!eval_frame(struct
_frame * f = 0x053f2bfc)+0x542 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c
@ 1965]
05 023ffb30 1e016a69 0099f170 023ffb7c 00000002
python23!fast_function(struct _object * func = <Memory access error>, struct
_object *** pp_stack = <Memory access error>, int n = <Memory access error>,
int na = <Memory access error>, int nk = <Memory access error>)+0x94

the above doesn't look very healthy. does your application involve
non-standard extensions (including extensions you've written your-
self)? does the extensions contain callbacks into Python code?

</F>
 
S

Saravanan D

Hello,

Component which uses only windows extension modules and callback from C++ to
Python.

- Saravanan D

Fredrik Lundh said:
Saravanan D said:
03 023ffaa4 1e013182 00000000 055b1250 00637470 python23!cmp_outcome(int op
= 88026108, struct _object * v = 0x00000001, struct _object * w =
0x00000000)+0xa9 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3880]
04 023ffb18 1e016ba4 014f3318 00000002 0099f170 python23!eval_frame(struct
_frame * f = 0x053f2bfc)+0x542 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c
@ 1965]
05 023ffb30 1e016a69 0099f170 023ffb7c 00000002
python23!fast_function(struct _object * func = <Memory access error>, struct
_object *** pp_stack = <Memory access error>, int n = <Memory access error>,
int na = <Memory access error>, int nk = <Memory access error>)+0x94

the above doesn't look very healthy. does your application involve
non-standard extensions (including extensions you've written your-
self)? does the extensions contain callbacks into Python code?

</F>
 
S

Saravanan D

Fredrik Lundh said:
Saravanan D said:
03 023ffaa4 1e013182 00000000 055b1250 00637470 python23!cmp_outcome(int op
= 88026108, struct _object * v = 0x00000001, struct _object * w =
0x00000000)+0xa9 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3880]
04 023ffb18 1e016ba4 014f3318 00000002 0099f170 python23!eval_frame(struct
_frame * f = 0x053f2bfc)+0x542 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c
@ 1965]
05 023ffb30 1e016a69 0099f170 023ffb7c 00000002
python23!fast_function(struct _object * func = <Memory access error>, struct
_object *** pp_stack = <Memory access error>, int n = <Memory access error>,
int na = <Memory access error>, int nk = <Memory access error>)+0x94

the above doesn't look very healthy. does your application involve
non-standard extensions (including extensions you've written your-
self)? does the extensions contain callbacks into Python code?

My application uses extension modules which devliers the callbacks to Python
Code. Im using SWIG 1.3.19 version to generate relevant python interfaces
for the C++ code.

In addition to that, the application uses Win32 extensions APIs.


Thanks in advance.
 
F

Fredrik Lundh

Saravanan D said:
03 023ffaa4 1e013182 00000000 055b1250 00637470 python23!cmp_outcome(int op
= 88026108, struct _object * v = 0x00000001, struct _object * w =
0x00000000)+0xa9 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3880]
04 023ffb18 1e016ba4 014f3318 00000002 0099f170 python23!eval_frame(struct
_frame * f = 0x053f2bfc)+0x542 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c
@ 1965]
05 023ffb30 1e016a69 0099f170 023ffb7c 00000002
python23!fast_function(struct _object * func = <Memory access error>, struct
_object *** pp_stack = <Memory access error>, int n = <Memory access error>,
int na = <Memory access error>, int nk = <Memory access error>)+0x94

the above doesn't look very healthy. does your application involve
non-standard extensions (including extensions you've written your-
self)? does the extensions contain callbacks into Python code?

My application uses extension modules which devliers the callbacks to Python
Code. Im using SWIG 1.3.19 version to generate relevant python interfaces
for the C++ code.

how are you accessing the callbacks? if you're doing that from threads
created at the C++ level, you must make sure that the thread state is
properly set up. see:


do you keep track of the thread state, so that callbacks run in the
same state as they were registered in?

</F>
 
F

Fredrik Lundh

(trying again)

Saravanan D said:
03 023ffaa4 1e013182 00000000 055b1250 00637470 python23!cmp_outcome(int op
= 88026108, struct _object * v = 0x00000001, struct _object * w =
0x00000000)+0xa9 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3880]
04 023ffb18 1e016ba4 014f3318 00000002 0099f170 python23!eval_frame(struct
_frame * f = 0x053f2bfc)+0x542 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c
@ 1965]
05 023ffb30 1e016a69 0099f170 023ffb7c 00000002
python23!fast_function(struct _object * func = <Memory access error>, struct
_object *** pp_stack = <Memory access error>, int n = <Memory access error>,
int na = <Memory access error>, int nk = <Memory access error>)+0x94

the above doesn't look very healthy. does your application involve
non-standard extensions (including extensions you've written your-
self)? does the extensions contain callbacks into Python code?

My application uses extension modules which devliers the callbacks to Python
Code. Im using SWIG 1.3.19 version to generate relevant python interfaces
for the C++ code.

how are you accessing the callbacks? if you're doing that from threads
created at the C++ level, you must make sure that the thread state is
properly set up. see:

http://www.python.org/doc/2.4.1/api/threads.html

if you're registering the callbacks from Python (via SWIG:ed "register"
calls), you must keep track of the thread state, so that callbacks run
in the same state as they were registered in.

</F>
 
S

Saravanan D

Fredrik Lundh said:
Saravanan D said:
03 023ffaa4 1e013182 00000000 055b1250 00637470
python23!cmp_outcome(int
op
= 88026108, struct _object * v = 0x00000001, struct _object * w =
0x00000000)+0xa9 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3880]
04 023ffb18 1e016ba4 014f3318 00000002 0099f170 python23!eval_frame(struct
_frame * f = 0x053f2bfc)+0x542 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c
@ 1965]
05 023ffb30 1e016a69 0099f170 023ffb7c 00000002
python23!fast_function(struct _object * func = <Memory access
error>,
struct
_object *** pp_stack = <Memory access error>, int n = <Memory access error>,
int na = <Memory access error>, int nk = <Memory access error>)+0x94

the above doesn't look very healthy. does your application involve
non-standard extensions (including extensions you've written your-
self)? does the extensions contain callbacks into Python code?

My application uses extension modules which devliers the callbacks to Python
Code. Im using SWIG 1.3.19 version to generate relevant python interfaces
for the C++ code.

how are you accessing the callbacks? if you're doing that from threads
created at the C++ level, you must make sure that the thread state is
properly set up. see:

Callbacks have been called from the threads which are created in C++ code.
Before calling the callback, the thread state has been properly set (as per
python documentation). The application runs 3 to 4 days continuously with
out having any issues. But, crash happens sparadically. (once in a week /
once in 4 days )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,205
Latest member
ShereeStan

Latest Threads

Top