Bug #8524 segfault when specifying a default schema
Submitted: 15 Feb 2005 21:10 Modified: 1 Sep 2006 19:02
Reporter: Matthew Daniel Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S2 (Serious)
Version:1.1.5 OS:Linux (FC3 (x86_64))
Assigned to: Alfredo Kojima CPU Architecture:Any

[15 Feb 2005 21:10] Matthew Daniel
Description:
After applying the aforementioned "gsize" patch to enable me to compile the query browser on amd64 / x86_64, I get a consistent segfault if I specify a valid database name for the "Default Schema" and try to connect to a mysql 4.0.24 (bk pull).

Here is the \s output from the server:
mysql  Ver 14.7 Distrib 4.1.10, for redhat-linux-gnu (x86_64)

Connection id:          217
Current database:       mysql
Current user:           root@192.168.60.127
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         4.0.24
Protocol version:       10
Connection:             vision via TCP/IP
Client characterset:    latin1
Server characterset:    latin1

Here is the bt from mysql-query-browser-bin:

(gdb) bt
#0  0x0000002a955a5374 in mysql_select_db (mysql=0x0, db=0xbd4820 "mysql")
    at client.c:2215
#1  0x000000000052f8e4 in myx_use_schema (mysql=0x0, schema=0xbd4820 "mysql")
    at myx_library.c:550
#2  0x000000000052d074 in use_schema_store_old_one (mysql=0x9e3740,
    schema_name=0xa14058 "mysql", old_schema_name=0x7fbfffe740)
    at myx_catalogs.c:105
#3  0x000000000052d101 in myx_get_schema_tables (mysql=0x9e3740,
    catalog_name=0xbd4820 "mysql", schema_name=0xa14058 "mysql")
    at myx_catalogs.c:149

Notice how between #2 and #1, mysql mysteriously gets NULLed. It actually occurs after the call to myx_convert_utf8_dbstr; but only AFTER it (that is, mysql has a "normal" value inside that function and right up to the "return" therein).

Contact me if I have left something out.

How to repeat:
$ rm -rf ~/.mysqlgui
$ mysql-query-browser
## input host, port [for a MySQL 4.0 db], username, password and then type mysql as the Default Schema
## press Connect
## watch fireworks
[2 Mar 2005 4:48] Alfredo Kojima
Hi

This one is a bit harder to track without having access to a local amd64 machine, but I've fixed a bunch of bugs in 1.1.5 that might have affected it. Can you try building it again from 1.1.6 and report back if it persists?

Thank you,
Alfredo
[2 Mar 2005 17:22] Matthew Daniel
I cannot speak to the licensing or other non-technical problems with this idea, but SourceForge.net offers an amd64/x86_64 machine in their compile farm.

I'm cloning the mysql-query-browser project right now and will report back how it goes.

Toward that end, it wouldn't hurt you guys to enumerate the list of bitkeeper projects somewhere. The dev.mysql.com site is horrible for finding that kind of information. I literally found it by guessing at the bitkeeper stat site.
[2 Mar 2005 20:25] Matthew Daniel
#0  0x0000003706f38374 in mysql_select_db (mysql=0x0, db=0xa30a00 "mysql") at client.c:2215
        error = 5
#1  0x0000000000536b34 in myx_use_schema (mysql=0x0, schema=0xa30a00 "mysql")
    at myx_library.c:580
        schema_name = 0xa30a00 "mysql"
        res = 0
#2  0x0000000000534124 in use_schema_store_old_one (mysql=0xa07880,
    schema_name=0xa3c978 "mysql", old_schema_name=0x7fbfffe770) at myx_catalogs.c:105
No locals.
#3  0x00000000005341b1 in myx_get_schema_tables (mysql=0xa07880,
    catalog_name=0xa30a00 "mysql", schema_name=0xa3c978 "mysql") at myx_catalogs.c:149
        schema_tables = (MYX_SCHEMA_TABLES *) 0xbfe740
        tables_res = (MYSQL_RES *) 0x7fbfffe880
        columns_res = (MYSQL_RES *) 0x7fbfffe880
        tbl_row = 0xa3c978
        clm_row = 0xa3c978
        sqlcmd = 0x7fbfffe7e0 "`S\uffff"
        old_db = 0xa07140 "mysql"
#4  0x000000000046fc46 in MQQueryDispatcher::get_tables (this=0xbc5ee0,
    catalog=@0x7fbfffe880, schema=@0xa3c978) at MQQueryDispatcher.cc:472
        tables = (MYX_SCHEMA_TABLES *) 0xa3c978
#5  0x00000000004d72cd in MQBaseModule::schemata_fetch_tables (this=0xa30a00,
    catalog=@0xa30a00, schema=@0xfefeff6b7072786c, tables=@0x7fbfffe828)
    at MQBaseModule.cc:35
No locals.
[26 Jan 2006 17:37] Jorge del Conde
I was able to reproduce this bug using FC4 under AMD64.
[1 Sep 2006 19:02] Alfredo Kojima
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html