[mod_python] mod_python and mysql - wierd problem!

David Geller dg at sponsera.com
Fri Jan 9 00:30:03 EST 2004


Paul Querna wrote:

> David Geller wrote:
>
>> 1. As far as I know, I am not running any other apache modules using 
MySQL ( I am not sure how to check this out definitely, but I cannot
seem to find any references anywhere to such modules....)
>>
>> 2. Yes, I built mysql,mod_python, python, MySQL, apache,.... from 
source.
>>
>> Also, everything (my entire mod_python application, including all 
mysql accessing), seems to run *fine* on my home machine
(redhat8-based). It is when I have tried running on our redhat-9-based
server where these problems start to appear....(note that I reuilt all
the sources on the redhat9 machine...)
>
>
> Could you try to get a Backtrace in GDB from the Apache Core Files?




Stack trace from wierd mod_python/mysql bug obtained!

================== basic program (outline) being run
from mod_python import util
from mod_python import apache
import MySQLdb

def hander(req):

db = MySQLdb.connect(db="quest1",
                          host="localhost",
                          user="dg",
                          passwd="pass")

     c = db.cursor(MySQLdb.cursors.DictCursor)
    sql = """select * from subject"""

     c.execute(sql)
==================================
Note that we get Seg fault on the c.execute().
And note also: with certain sql statements, does not crash but obtain
inconsistant results.


=====================GDB Stack ========================================

(gdb) r
Starting program: /usr/local/apache2/sbin/httpd -DONE_PROCESS
[New Thread 16384 (LWP 17860)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 17860)]
0x402f8a92 in do_mkvalue (p_format=0xa, p_va=0xa) at Python/modsupport.c:334

(gdb) where
#0  0x402f8a92 in do_mkvalue (p_format=0xa, p_va=0xa)
     at Python/modsupport.c:334
#1  0x402f8f9a in do_mktuple (p_format=0xbfffe790, p_va=0xbfffe794,
     endchar=41, n=7) at Python/modsupport.c:223
#2  0x402f88cf in do_mkvalue (p_format=0xbfffe790, p_va=0xbfffe794)
     at Python/modsupport.c:247
#3  0x402f8b4c in Py_VaBuildValue (format=0x0, va=0x0)
     at Python/modsupport.c:428
#4  0x402f8aea in Py_BuildValue (format=0x406ceb95 "(siiiiii)")
     at Python/modsupport.c:399
#5  0x406cce33 in _mysql_ResultObject_describe (self=0x828f160, args=0x0)
     at _mysql.c:737
#6  0x402d6988 in fast_cfunction (func=0x0, pp_stack=0xbfffe8c4, na=-1)
     at Python/ceval.c:3132
#7  0x402d51d5 in eval_frame (f=0x822baec) at Python/ceval.c:2017
#8  0x402d5be3 in PyEval_EvalCodeEx (co=0x81fa500, globals=0x0, locals=0x0,
     args=0x822b73c, argcount=2, kws=0x822b744, kwcount=0, defs=0x0,
     defcount=0, closure=0x0) at Python/ceval.c:2595
#9  0x402d6a1f in fast_function (func=0x0, pp_stack=0x0, n=0, na=2, nk=0)
     at Python/ceval.c:3170
#10 0x402d514f in eval_frame (f=0x822b5e4) at Python/ceval.c:2034
#11 0x402d5be3 in PyEval_EvalCodeEx (co=0x8285908, globals=0x0, locals=0x0,
     args=0x82491dc, argcount=2, kws=0x82491e4, kwcount=0, defs=0x0,
     defcount=0, closure=0x0) at Python/ceval.c:2595
#12 0x402d6a1f in fast_function (func=0x0, pp_stack=0x0, n=0, na=2, nk=0)
     at Python/ceval.c:3170
#13 0x402d514f in eval_frame (f=0x8249064) at Python/ceval.c:2034
#14 0x402d5be3 in PyEval_EvalCodeEx (co=0x81f95d0, globals=0x0, locals=0x0,
     args=0x817341c, argcount=3, kws=0x8173428, kwcount=0, defs=0x0,
     defcount=0, closure=0x0) at Python/ceval.c:2595
#15 0x402d6a1f in fast_function (func=0x0, pp_stack=0x0, n=0, na=3, nk=0)
     at Python/ceval.c:3170
#16 0x402d514f in eval_frame (f=0x81732c4) at Python/ceval.c:2034
#17 0x402d5be3 in PyEval_EvalCodeEx (co=0x81f8df8, globals=0x0, locals=0x0,
     args=0x8173410, argcount=2, kws=0x823b4a0, kwcount=0, defs=0x8289a80,
     defcount=1, closure=0x0) at Python/ceval.c:2595
#18 0x402d6a1f in fast_function (func=0x0, pp_stack=0x0, n=0, na=2, nk=0)
     at Python/ceval.c:3170
#19 0x402d514f in eval_frame (f=0x823b32c) at Python/ceval.c:2034
#20 0x402d5be3 in PyEval_EvalCodeEx (co=0x823ef80, globals=0x0, locals=0x0,
     args=0x8233280, argcount=1, kws=0x8233284, kwcount=0, defs=0x0,
     defcount=0, closure=0x0) at Python/ceval.c:2595
#21 0x402d6a1f in fast_function (func=0x0, pp_stack=0x0, n=0, na=1, nk=0)
     at Python/ceval.c:3170
#22 0x402d514f in eval_frame (f=0x82330d4) at Python/ceval.c:2034
#23 0x402d5be3 in PyEval_EvalCodeEx (co=0x81e6b18, globals=0x0, locals=0x0,
     args=0x81d0640, argcount=2, kws=0x0, kwcount=0, defs=0x0, defcount=0,
     closure=0x0) at Python/ceval.c:2595
#24 0x4031a729 in function_call (func=0x822f7d4, arg=0x81d0634, kw=0x0)
     at Objects/funcobject.c:476
#25 0x4029d0b8 in PyObject_Call (func=0xffffffff, arg=0x81d0634, kw=0x0)
     at Objects/abstract.c:1688
#26 0x402a3148 in instancemethod_call (func=0x822f7d4, arg=0x81d0634,
kw=0x0)
     at Objects/classobject.c:2315
#27 0x4029d0b8 in PyObject_Call (func=0xffffffff, arg=0x81e99d4, kw=0x0)
     at Objects/abstract.c:1688
#28 0x402d6847 in PyEval_CallObjectWithKeywords (func=0x81cc8b4,
     arg=0x81e99d4, kw=0x0) at Python/ceval.c:3058
#29 0x4029aa8d in PyObject_CallMethod (o=0x0, name=0x81e99d4 "\002",
     format=0x81e99d4 "\002") at Objects/abstract.c:1679
#30 0x402985fc in python_handler (req=0x81bb018,
     phase=0x4031ee18 "PythonHandler") at mod_python.c:899
#31 0x4029973e in PythonHandler (req=0x81bb018) at mod_python.c:1699
#32 0x0807baca in ap_run_handler (r=0x81bb018) at config.c:195
#33 0x0807bfe2 in ap_invoke_handler (r=0x81bb018) at config.c:401
#34 0x0806bd8b in ap_process_request (r=0x81bb018) at http_request.c:288
#35 0x08067f25 in ap_process_http_connection (c=0x81b6fe8) at
http_core.c:293
#36 0x0808493a in ap_run_process_connection (c=0x81b6fe8) at connection.c:85
#37 0x0807a67f in child_main (child_num_arg=0) at prefork.c:694
#38 0x0807a82a in make_child (s=0x80b7118, slot=0) at prefork.c:734
#39 0x0807a883 in startup_children (number_to_start=5) at prefork.c:806
#40 0x0807af75 in ap_mpm_run (_pconf=0x8079f68, plog=0x80ecaf0, s=0x80b7118)
     at prefork.c:1022
#41 0x0807fd02 in main (argc=2, argv=0xbffff404) at main.c:660
#42 0x401415cd in __libc_start_main () from /lib/libc.so.6
(gdb)







More information about the Mod_python mailing list