[mod_python] null pointer to PyObject_CallMethod

Nicholas Milkovits nmilkovits at gmail.com
Sat Mar 24 14:31:20 EST 2007


Hello,

I am trying to find out the cause of a segmentation fault that occurs
when occasionally processing database requests. The environment is
Apache 2.0.59 (it happens when run in either prefork or threaded), Mod
Python 3.3.1, Python 2.5 and cx_Oracle 4.3. All of this software was
compiled from source. The database is Oracle 10g (I believe). I have
pasted a stack trace from gdb below but here is my question:

It appears the seg fault is in the database code but in frames 17 - 14
it appears as though the func argument is a NULL pointer. How is it
possible that execution continues after the call from python_handler
into the interpreter when the beginning of the PyObject_CallMethod is
supposed to raise an error if the func argument is NULL. Is this a
problem with gdb or is there something going on that I am missing?
Thanks for the help

PyObject *
PyObject_CallMethod(PyObject *o, char *name, char *format, ...)
{
	va_list va;
	PyObject *args;
	PyObject *func = NULL;
	PyObject *retval = NULL;

	if (o == NULL || name == NULL)
		return null_error();

        .....function continues

#0  0xad8d7ba5 in kpureq2 ()
   from /usr/vendor/pkg/oracle/product/10.2.0/lib/libclntsh.so.10.1
#1  0xad9b6dc3 in OCIStmtPrepare2 ()
   from /usr/vendor/pkg/oracle/product/10.2.0/lib/libclntsh.so.10.1
#2  0x069ac873 in Cursor_InternalPrepare (self=0x9968d80, statement=0x98b326c)
    at Cursor.c:1073
#3  0x069ad82d in Cursor_Execute (self=0xacb8f020, args=0x1774,
    keywordArgs=0x98b326c) at Cursor.c:1397
#4  0x00674561 in PyCFunction_Call (func=0xacba58ec, arg=0xacb48eac,
    kw=0xae41c10c) at Objects/methodobject.c:77
#5  0x006a9ff6 in PyEval_EvalFrameEx (f=0x994c19c, throwflag=0)
    at Python/ceval.c:3566
#6  0x006aaff3 in PyEval_EvalFrameEx (f=0x994c02c, throwflag=0)
    at Python/ceval.c:3652
#7  0x006aaff3 in PyEval_EvalFrameEx (f=0x98198c4, throwflag=0)
    at Python/ceval.c:3652
#8  0x006aaff3 in PyEval_EvalFrameEx (f=0x9819724, throwflag=0)
    at Python/ceval.c:3652
#9  0x006aaff3 in PyEval_EvalFrameEx (f=0x97f3bf4, throwflag=0)
    at Python/ceval.c:3652
#10 0x006ab8a6 in PyEval_EvalCodeEx (co=0xae6585c0, globals=0xae41c10c,
    locals=0x1774, args=0x7, argcount=0, kws=0x97f3b84, kwcount=7, defs=0x0,
    defcount=0, closure=0x0) at Python/ceval.c:2833
#11 0x006a9c6c in PyEval_EvalFrameEx (f=0x97f39fc, throwflag=0)
    at Python/ceval.c:3661
#12 0x006ab8a6 in PyEval_EvalCodeEx (co=0xae658698, globals=0xae41c10c,
    locals=0x1774, args=0x0, argcount=2, kws=0x0, kwcount=0, defs=0x0,
    defcount=0, closure=0x0) at Python/ceval.c:2833
#13 0x00701318 in function_call (func=0xae5dd144, arg=0xad71790c, kw=0x0)
    at Objects/funcobject.c:517
#14 0x0064f397 in PyObject_Call (func=0x0, arg=0x1774, kw=0x1774)
    at Objects/abstract.c:1860
#15 0x00658cee in instancemethod_call (func=0x1774, arg=0xad71790c, kw=0x1774)
    at Objects/classobject.c:2493
#16 0x0064f397 in PyObject_Call (func=0x0, arg=0x1774, kw=0x1774)
    at Objects/abstract.c:1860
#17 0x0064f750 in PyObject_CallMethod (o=0x0, name=0xad72456c "\001",
    format=0x72ae92 "O") at Objects/abstract.c:1891
#18 0x00648c32 in python_handler (req=0x993a038,
    phase=0x71ba44 "PythonHandler") at mod_python.c:1652
#19 0x0064a9ca in PythonHandler (req=0x993a038) at mod_python.c:2878


More information about the Mod_python mailing list