Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#65 import MySQLdb segfault Solaris 7

Andy Dustman
MySQLdb (285)

MySQLdb 0.9.2 compiles fine but segfaults on import.

Python 2.2.3 (#1, Aug 26 2003, 23:07:17)
[GCC 2.95.3 20010315 (release)] on sunos5
Type "help", "copyright", "credits" or "license" for
more information.
>>> import MySQLdb
Segmentation Fault (core dumped)

I am currently working with Solaris 7, Python 2.2.3
compiled from source, MySQL 3.23.57 compiled from
source, and GCC 2.95.3.

I have also tried Python 2.2.2 and GCC 3.2.2 to no
avail. Configure for MySQL looks like this:

--enable-thread-safe-client --with-low-memory

I have everything working on Redhat 9 and I know
Solaris 7 is really old, but I thought I would report
this in case anyone has experienced similar problems.


<< < 1 2 (Page 2 of 2)
  • Lance French
    Lance French

    Logged In: YES

    That error message is part of Python/modsupport.c where it
    runs through the methods you are importing and checks for
    proper names and such. (See Py_Initmodule4())

    I played with _mysql.c for a bit and was able to get around
    the error, and even import MySQLdb, by making some changes
    to the _mysql_methods[] array. (Changed the position of the
    sentinel.) However, I would still core dump as soon as I
    tried to do anything like connect to a database.

    I have the same results with 0.9.3b2. I am able to import
    and then blow up if I try to connect. I will paste the bt
    momentarily, because it is the same for both versions, but
    since it flows from libc to libmysqlclient I am guessing
    something is not quite right about my compiler set up to
    begin with. :(

  • Lance French
    Lance French

    Logged In: YES

    Currently working with Python-2.3.2, but I can downgrade again.

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "MySQLdb/", line 63, in Connect
    return apply(Connection, args, kwargs)
    File "MySQLdb/", line 116, in init
    self.converter[types.StringType] = self.string_literal
    TypeError: object does not support item assignment
    >>> type something here and hit enter

    Program received signal SIGBUS, Bus error.
    0xff146678 in _free_unlocked () from /usr/lib/
    (gdb) bt

    0 0xff146678 in _free_unlocked () from /usr/lib/

    1 0xff146630 in free () from /usr/lib/

    2 0xfe7cb73c in my_no_flags_free ()

    from /usr/local/mysql/lib/mysql/

    3 0xfe7c80ec in mysql_close ()

    from /usr/local/mysql/lib/mysql/

    4 0xff0247cc in _mysql_ConnectionObject_close

    (self=0x210470, args=0x118030)
    at _mysql.c:553

    5 0xcbd44 in PyCFunction_Call (func=0x1d1f80,

    arg=0x118030, kw=0x0)
    at Objects/methodobject.c:108

    6 0x80878 in call_function (pp_stack=0xffbeefe0,

    at Python/ceval.c:3439

    7 0x7e3a4 in eval_frame (f=0x2102b0) at Python/ceval.c:2116

    8 0x7f958 in PyEval_EvalCodeEx (co=0x1b4ca0, globals=0x0,

    args=0x1c217c, argcount=1, kws=0x0, kwcount=0, defs=0x0,
    closure=0x0) at Python/ceval.c:2663

    9 0xcb120 in function_call (func=0x1c1530, arg=0x1c2170,

    at Objects/funcobject.c:504

    10 0x235c8 in PyObject_Call (func=0x1c1530, arg=0x1c2170,

    at Objects/abstract.c:1755

    11 0x2b8d4 in instancemethod_call (func=0x1c1530,

    arg=0x1c2170, kw=0x0)
    at Objects/classobject.c:2433

    12 0x235c8 in PyObject_Call (func=0x1c1530, arg=0x1c2170,

    at Objects/abstract.c:1755

    13 0x806fc in PyEval_CallObjectWithKeywords (func=0x12e710,

    kw=0x0) at Python/ceval.c:3346

    14 0x5ecf8 in slot_tp_del (self=0x210470) at


    15 0x53a0c in subtype_dealloc (self=0x210470) at


    16 0xc9530 in frame_dealloc (f=0x1810d0) at


    17 0xa7b4c in tb_dealloc (tb=0x1d6788) at Python/traceback.c:41

    18 0xa7b14 in tb_dealloc (tb=0x1d67b0) at Python/traceback.c:40

    19 0xa7b14 in tb_dealloc (tb=0x1d67d8) at Python/traceback.c:40

    20 0x4246c in PyDict_SetItem (op=0x11a780, key=0x1af160,

    at Objects/dictobject.c:379

    21 0x44c9c in PyDict_SetItemString (v=0x11a780, key=0xdbba0

    item=0x1ade90) at Objects/dictobject.c:1976

    22 0xa72e4 in PySys_SetObject (name=0xdbba0

    "last_traceback", v=0x1ade90)
    at Python/sysmodule.c:82

    23 0xa42f0 in PyErr_PrintEx (set_sys_last_vars=1) at


    24 0xa5434 in PyErr_Print () at Python/pythonrun.c:941

    25 0xa3a4c in PyRun_InteractiveOneFlags (fp=0xffffffff,

    filename=0xcf0a8 &quot;&lt;stdin&gt;&quot;, flags=0xffbefbbc) at


    26 0xa5088 in PyRun_InteractiveLoopFlags (fp=0x113ed0,

    filename=0xcf0a8 &quot;&lt;stdin&gt;&quot;, flags=0xffbefbbc) at


    27 0xa4e30 in PyRun_AnyFileExFlags (fp=0x113ed0,

    filename=0xcf0a8 "<stdin>",
    closeit=0, flags=0xffbefbbc) at Python/pythonrun.c:627

    28 0x1cb28 in Py_Main (argc=1, argv=0xffbefca4) at


    29 0x1c360 in main (argc=1, argv=0xffbefca4) at

    (gdb) Quit

  • Andy Dustman
    Andy Dustman

    Logged In: YES

    OK, I see that code in 2.3.2; it was not in 2.2.3. However,
    I've tested with 2.3.2 and don't get anything like that on
    i386. There's nothing in the code that makes that
    platform-dependent, though.

  • Lance French
    Lance French

    Logged In: YES

    Yes, the error is now identical to the one in the bug you
    mentioned. So you may close this ticket, there has to be
    something wrong with my GCC installation (wrong libs for the
    compiler or something, damn sunfreeware). I'll try
    compiling gcc from scratch and see how I do.

    As for the _mysql_methods[] problem, that already seems to
    be cleared up in your 0.9.3 code.

    I appreciate the help.

  • Lance French
    Lance French

    Logged In: YES

    FYI, I recompiled everything with gcc 3.3.2 on solaris, but
    mysql_real_connect() still bombs with malloc() errors.
    Something is not jiving between libc and mysqlclient on
    Solaris. libc6 (linux) systems seem to have no problem.
    From the other bug you mentioned, looks like the Mac OS X
    (freebsd) people are in the same boat to a certain extent.
    I am giving up on this one.

<< < 1 2 (Page 2 of 2)