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.

Close

#118 Segmentation fault in MATCH AGAINST queries

MySQLdb-1.1
closed
Andy Dustman
MySQLdb (285)
5
2012-09-19
2005-01-05
Eugene Bond
No

MySQLdb: 1.1.7, 1.1.8
MySQL: 4.1.7
System: FreeBSD

In queries "SELECT blabla, MATCH foo AGAINST ('bar') AS
rel FROM table..." I got "Segmentation fault" and
process stoped..
All other SELECTs, INSERTs, etc works fine.

Discussion

1 2 > >> (Page 1 of 2)
  • Andy Dustman
    Andy Dustman
    2005-01-05

    Logged In: YES
    user_id=71372

    It's not clear from your comments whether the client or the
    server is crashing. If it's the server, there's not much I
    can do about this, although I will note that the current
    version is 4.1.8.

     
  • Eugene Bond
    Eugene Bond
    2005-01-05

    Logged In: YES
    user_id=1190738

    No, this SQL is just for example. Full sintax is correct and
    works from console and phpMyAdmin.

    "SELECT id, text, MATCH text AGAINST ('%s') AS rel FROM
    texttable HAVING rel > 20 ORDER BY rel DESC"

    Segmantation fault comes from client. And program is
    aborted. There is no debug-backtrace but if I set comment on
    query-line - programm not crash.

     
  • Andy Dustman
    Andy Dustman
    2005-01-05

    Logged In: YES
    user_id=71372

    I can't do much without a backtrace.

    $ gdb python
    (gdb) run yourscript.py
    <crash>
    (gdb) bt

    Post the output of bt here.

     
  • Eugene Bond
    Eugene Bond
    2005-01-06

    Logged In: YES
    user_id=1190738

    Here is bt, but my dummy eyes don't see any helfull info..


    Program received signal SIGSEGV, Segmentation fault.
    0x80b0e17 in Py_InitModule4 ()
    (gdb) bt

    0 0x80b0e17 in Py_InitModule4 ()

    1 0x80b0bb0 in Py_InitModule4 ()

    2 0x80b0c8e in Py_InitModule4 ()

    3 0x80b0f3c in Py_VaBuildValue ()

    4 0x80b0ed1 in Py_BuildValue ()

    5 0x2836adad in _mysql_ResultObject_describe () from

    /usr/local/lib/python2.4/site-packages/_mysql.so

    6 0x80ce274 in PyCFunction_Call ()

    7 0x8099e44 in PyEval_GetFuncDesc ()

    8 0x8097fc3 in PyEval_EvalFrame ()

    9 0x8099fd3 in PyEval_GetFuncDesc ()

    10 0x8099ec9 in PyEval_GetFuncDesc ()

    11 0x8097fc3 in PyEval_EvalFrame ()

    12 0x8099fd3 in PyEval_GetFuncDesc ()

    13 0x8099ec9 in PyEval_GetFuncDesc ()

    14 0x8097fc3 in PyEval_EvalFrame ()

    15 0x8099fd3 in PyEval_GetFuncDesc ()

    16 0x8099ec9 in PyEval_GetFuncDesc ()

    17 0x8097fc3 in PyEval_EvalFrame ()

    18 0x8098e40 in PyEval_EvalCodeEx ()

    19 0x809a038 in PyEval_GetFuncDesc ()

    20 0x8099ec9 in PyEval_GetFuncDesc ()

    21 0x8097fc3 in PyEval_EvalFrame ()

    22 0x8099fd3 in PyEval_GetFuncDesc ()

    23 0x8099ec9 in PyEval_GetFuncDesc ()

    24 0x8097fc3 in PyEval_EvalFrame ()

    25 0x8099fd3 in PyEval_GetFuncDesc ()

    26 0x8099ec9 in PyEval_GetFuncDesc ()

    27 0x8097fc3 in PyEval_EvalFrame ()

    28 0x8098e40 in PyEval_EvalCodeEx ()

    29 0x809a038 in PyEval_GetFuncDesc ()

    30 0x8099ec9 in PyEval_GetFuncDesc ()

    31 0x8097fc3 in PyEval_EvalFrame ()

    32 0x8099fd3 in PyEval_GetFuncDesc ()

    33 0x8099ec9 in PyEval_GetFuncDesc ()

    34 0x8097fc3 in PyEval_EvalFrame ()

    35 0x8098e40 in PyEval_EvalCodeEx ()

    36 0x809a038 in PyEval_GetFuncDesc ()

    37 0x8099ec9 in PyEval_GetFuncDesc ()

    38 0x8097fc3 in PyEval_EvalFrame ()

    39 0x8099fd3 in PyEval_GetFuncDesc ()

    40 0x8099ec9 in PyEval_GetFuncDesc ()

    41 0x8097fc3 in PyEval_EvalFrame ()

    42 0x8099fd3 in PyEval_GetFuncDesc ()

    43 0x8099ec9 in PyEval_GetFuncDesc ()

    44 0x8097fc3 in PyEval_EvalFrame ()

    45 0x8099fd3 in PyEval_GetFuncDesc ()

    46 0x8099ec9 in PyEval_GetFuncDesc ()

    47 0x8097fc3 in PyEval_EvalFrame ()

    48 0x8098e40 in PyEval_EvalCodeEx ()

    49 0x80cdd1a in PyFunction_SetClosure ()

    50 0x8059a08 in PyObject_Call ()

    ---Type <return> to continue, or q <return> to quit---

    51 0x809a48e in PyEval_GetFuncDesc ()

    52 0x8098081 in PyEval_EvalFrame ()

    53 0x8098e40 in PyEval_EvalCodeEx ()

    54 0x80cdd1a in PyFunction_SetClosure ()

    55 0x8059a08 in PyObject_Call ()

    56 0x809a48e in PyEval_GetFuncDesc ()

    57 0x8098081 in PyEval_EvalFrame ()

    58 0x8098e40 in PyEval_EvalCodeEx ()

    59 0x80cdd1a in PyFunction_SetClosure ()

    60 0x8059a08 in PyObject_Call ()

    61 0x809a48e in PyEval_GetFuncDesc ()

    62 0x8098081 in PyEval_EvalFrame ()

    63 0x8098e40 in PyEval_EvalCodeEx ()

    64 0x809a038 in PyEval_GetFuncDesc ()

    65 0x8099ec9 in PyEval_GetFuncDesc ()

    66 0x8097fc3 in PyEval_EvalFrame ()

    67 0x8098e40 in PyEval_EvalCodeEx ()

    68 0x809a038 in PyEval_GetFuncDesc ()

    69 0x8099ec9 in PyEval_GetFuncDesc ()

    70 0x8097fc3 in PyEval_EvalFrame ()

    71 0x8099fd3 in PyEval_GetFuncDesc ()

    72 0x8099ec9 in PyEval_GetFuncDesc ()

    73 0x8097fc3 in PyEval_EvalFrame ()

    74 0x8098e40 in PyEval_EvalCodeEx ()

    75 0x809a038 in PyEval_GetFuncDesc ()

    76 0x8099ec9 in PyEval_GetFuncDesc ()

    77 0x8097fc3 in PyEval_EvalFrame ()

    78 0x8098e40 in PyEval_EvalCodeEx ()

    79 0x8095c49 in PyEval_EvalCode ()

    80 0x80b3933 in PyRun_FileExFlags ()

    81 0x80b38ee in PyRun_FileExFlags ()

    82 0x80b38c4 in PyRun_FileExFlags ()

    83 0x80b2c0f in PyRun_SimpleFileExFlags ()

    84 0x80b26c0 in PyRun_AnyFileExFlags ()

    85 0x8054d5f in Py_Main ()

    86 0x805445d in main ()

    87 0x805438e in _start ()

     
  • Andy Dustman
    Andy Dustman
    2005-01-06

    Logged In: YES
    user_id=71372

    5 0x2836adad in _mysql_ResultObject_describe () from

    /usr/local/lib/python2.4/site-packages/_mysql.so

    That's the culprit. Something in your result set makes it
    unhappy.

        t = Py_BuildValue("(siiiiii)",
                  fields[i].name,
                  (long) fields[i].type,
                  (long) fields[i].max_length,
                  (long) fields[i].length,
                  (long) fields[i].length,
                  (long) fields[i].decimals,
                  (long) !(IS_NOT_NULL(fields[i].flags)));
    

    And the only thing possible that I can see is
    fields[i].name, since it is a string. Perhaps it's getting a
    NULL pointer back from MySQL?

    You are renaming your MATCH expression to rel, which should
    not be a problem.

    Try adding to setup.py (in the section for your platform)
    something like this:

    extra_compile_args.append("-g")
    

    This should add some debugging information, which will give
    a better backtrace. Then rebuild and try again. You should
    also be able to do this:

    (gdb) frame 4 # assuming it dies the same way
    (gdb) print i,fields[i]

     
  • Eugene Bond
    Eugene Bond
    2005-01-11

    Logged In: YES
    user_id=1190738

    I'll try it in next few days and report ASAP

     
  • Eugene Bond
    Eugene Bond
    2005-01-17

    Logged In: YES
    user_id=1190738

    Crashed on start with error:

    File
    "/usr/local/lib/python2.4/site-packages/MySQLdb/init.py",
    line 27, in ?
    import _mysql
    ImportError:
    /usr/local/lib/python2.4/site-packages/_mysql.so: Undefined
    symbol "mysql_rollback"
    (no debugging symbols found)...
    Program exited with code 01.

     
  • Eugene Bond
    Eugene Bond
    2005-01-17

    Logged In: YES
    user_id=1190738

    With MySQLdb v.1.0.1 it crach like old times and I got this
    debug info:

    (gdb) frame 5

    5 0x2836add5 in _mysql_ResultObject_describe

    (self=0x8400d24, args=0x811f02c) at _mysql.c:923
    923 t = Py_BuildValue("(siiiiii)",
    (gdb) print i,fields[i]
    $1 = {name = 0x837622c "", org_name = 0x131 <Error reading="" address="" 0x131:="" Bad="" address="">, table = 0x0,
    org_table = 0x8376178 "", db = 0x2607 <Error reading="" address="" 0x2607:="" Bad="" address="">, catalog = 0x0,
    def = 0x8376100 "", length = 224, max_length = 0,
    name_length = 137847712, org_name_length = 305,
    table_length = 0, org_table_length = 137847580, db_length
    = 305, catalog_length = 0, def_length = 138555056,
    flags = 171, decimals = 0, charsetnr = 136315700, type = 305}

     
  • Andy Dustman
    Andy Dustman
    2005-01-21

    Logged In: YES
    user_id=71372

    I'll have to see if I can reproduce this, I guess.
    Something defintely looks screwy, but I still tend to think
    it's MySQL. 4.1.9 is out now.

    I wonder if mysql_fetch_fields() could be returning a NULL
    pointer. print fields in gdb should show if that is what is
    happening. The documentation does not say that can happen.

    http://dev.mysql.com/doc/mysql/en/mysql_fetch_fields.html

    You might also examine the value of n in that stack frame,
    which is the number of fields. Also d is the description
    tuple (return value).

     
1 2 > >> (Page 1 of 2)