crash with libmysqld
Hello,
I'm trying to run the following program with libmysqld (5.0.91), and it is crashing on the mysql_library_end(); call with
Program terminated with signal 11, Segmentation fault.
#0 0x000000000058fbcd in innobase_release_stat_resources (trx=0xcdcdcdcdcdcdcdcd) at third_party/mysql50/sql/ha_innodb.cc:394
394 if (trx->has_search_latch) {
(gdb) bt
#0 0x000000000058fbcd in innobase_release_stat_resources (trx=0xcdcdcdcdcdcdcdcd) at third_party/mysql50/sql/ha_innodb.cc:394
#1 0x0000000000584ebc in innobase_release_temporary_latches (thd=0x7f5e7f850418) at third_party/mysql50/sql/ha_innodb.cc:425
#2 0x0000000000587244 in ha_innobase::close (this=0x7f5e84159b60) at third_party/mysql50/sql/ha_innodb.cc:2335
#3 0x0000000000713b33 in closefrm (table=0x7f5e8415da18) at third_party/mysql50/sql/table.cc:996
#4 0x000000000060f446 in intern_close_table (table=0x7f5e8415da18) at third_party/mysql50/sql/sql_base.cc:261
#5 0x000000000060f465 in free_cache_entry (table=0x7f5e8415da18) at third_party/mysql50/sql/sql_base.cc:280
#6 0x0000000000744357 in hash_delete (hash=0xe11020, record=0x7f5e8415da18 "\340\341\025\204^\177")
at third_party/mysql50/mysys/hash.c:539
#7 0x000000000060f58e in close_cached_tables (thd=0x0, if_wait_for_refresh=false, tables=0x0) at third_party/mysql50/sql/sql_base.cc:334
#8 0x000000000060f009 in table_cache_free () at third_party/mysql50/sql/sql_base.cc:117
#9 0x0000000000573fa9 in clean_up (print_message=false) at third_party/mysql50/libmysqld/../sql/mysqld.cc:1185
#10 0x000000000057986a in end_embedded_server () at third_party/mysql50/libmysqld/lib_sql.cc:561
#11 0x000000000056ab96 in mysql_server_end () at third_party/mysql50/libmysqld/libmysql.c:202
#12 0x000000000056aa3f in main (argc=6, argv=0x7fffc184a9b8) at storage/speckle/server/mysql/mysql_vanilla.cc:41
static MYSQL* Connect(const char* database) {
MYSQL* db = mysql_init(NULL);
assert(db != NULL);
mysql_options(db, MYSQL_OPT_USE_EMBEDDED_CONNECTION, NULL);
assert(db == mysql_real_connect(db, NULL, "mysql_test", NULL, database,
0, NULL, 0));
mysql_autocommit(db, true);
return db;
}
int main(int argc, char* argv[]) {
assert(0 == mysql_library_init(argc, argv, 0));
assert(1 == mysql_thread_safe());
assert(0 == mysql_thread_init());
{
// Create the database.
MYSQL* db = Connect(NULL);
assert(0 == mysql_query(db, "create database if not exists d"));
mysql_close(db);
}
// Open a connection to the new database.
MYSQL* db = Connect("d");
// Create the table.
assert(0 == mysql_query(
db, "create table if not exists t (i integer) engine=innodb"));
assert(0 == mysql_query(db, "insert into t values (1);"));
mysql_close(db);
mysql_thread_end();
mysql_library_end();
}
Any idea what's going on?
Thanks,
jm.