Description:
Upon running tests/client_test.c, I get a segfault.
[MySQL-4.1.1-alpha-standard-log][2013] Lost connection to MySQL server during query
 [MySQL-4.1.1-alpha-standard-log][2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
client: client_test.c:963: test_prepare_simple: Assertion `stmt != 0' failed.
Aborted
The line of code in question:
     strmov(query,"SELECT * FROM test_prepare_simple WHERE id=? AND name= ?");
     stmt = mysql_prepare(mysql, query, strlen(query));
-->  mystmt_init(stmt);
Which is just doing a 'assert' to test whether stmt is defined.
Looking at the SQL log:
7 Prepare     DELETE FROM test_prepare_simple WHERE id=?
/usr/sbin/mysqld, Version: 4.1.1-alpha-standard-log, started with:
Tcp port: 3306  Unix socket: /var/lib/mysql/mysql.sock
Time                 Id Command    Argument
Then, the server log:
Number of processes running now: 0
040121 15:28:35  mysqld restarted
mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.
key_buffer_size=4194304
read_buffer_size=4190208
max_used_connections=0
max_connections=100
threads_connected=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 822895 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
thd=0x8636f30
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0xbfe7eed8, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x8089167
0x82da818
0x8529833
0x80cbb85
0x80cc962
0x8095713
0x8095192
0x8094907
0x82d7fcc
0x830b8fa
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://www.mysql.com/doc/en/Using_stack_trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x862c0b0 = DELETE FROM test_prepare_simple WHERE id=?
thd->thread_id=1
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.
Looking at the stack trace shows:
krsna:~ # resolve_stack_dump /usr/lib/mysql/mysqld.sym stacktrace.txt
0x8089167 handle_segfault + 423
0x82da818 pthread_sighandler + 184
0x8529833 __vt_4Item + 19
0x80cbb85 setup_params_data__FP12st_prep_stmt + 149
0x80cc962 mysql_stmt_execute__FP3THDPc + 274
0x8095713 dispatch_command__F19enum_server_commandP3THDPcUi + 1395
0x8095192 do_command__FP3THD + 162
0x8094907 handle_one_connection + 551
0x82d7fcc pthread_start_thread + 220
0x830b8fa thread_start + 4
From IRC:
<JeremyC> well it crashed in Item::Item()
This 4.1 is from RPMs, not compiled, if that's of any use.
How to repeat:
I compiled client_test.c as such:
gcc -o client client_test.c `mysql_config --cflags` `mysql_config --libs`
then simply run the binary with args needed to connect to your db.
note: if I take out the lines that run the prepare statement with a placeholder, it runs until:
MySQL-4.1.1-alpha-standard-log][1065] Query was empty
client: client_test.c:5601: test_pure_coverage: Assertion `rc != 0' failed.
Aborted
And the SQL log:
                      1 Prepare
                      1 Prepare     insert into test_pure(c2) values(10)
But, at least this isn't restarting the server ;)
  
 
 
 
Description: Upon running tests/client_test.c, I get a segfault. [MySQL-4.1.1-alpha-standard-log][2013] Lost connection to MySQL server during query [MySQL-4.1.1-alpha-standard-log][2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) client: client_test.c:963: test_prepare_simple: Assertion `stmt != 0' failed. Aborted The line of code in question: strmov(query,"SELECT * FROM test_prepare_simple WHERE id=? AND name= ?"); stmt = mysql_prepare(mysql, query, strlen(query)); --> mystmt_init(stmt); Which is just doing a 'assert' to test whether stmt is defined. Looking at the SQL log: 7 Prepare DELETE FROM test_prepare_simple WHERE id=? /usr/sbin/mysqld, Version: 4.1.1-alpha-standard-log, started with: Tcp port: 3306 Unix socket: /var/lib/mysql/mysql.sock Time Id Command Argument Then, the server log: Number of processes running now: 0 040121 15:28:35 mysqld restarted mysqld got signal 11; This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked against is corrupt, improperly built, or misconfigured. This error can also be caused by malfunctioning hardware. We will try our best to scrape up some info that will hopefully help diagnose the problem, but since we have already crashed, something is definitely wrong and this may fail. key_buffer_size=4194304 read_buffer_size=4190208 max_used_connections=0 max_connections=100 threads_connected=1 It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 822895 K bytes of memory Hope that's ok; if not, decrease some variables in the equation. thd=0x8636f30 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... Cannot determine thread, fp=0xbfe7eed8, backtrace may not be correct. Stack range sanity check OK, backtrace follows: 0x8089167 0x82da818 0x8529833 0x80cbb85 0x80cc962 0x8095713 0x8095192 0x8094907 0x82d7fcc 0x830b8fa New value of fp=(nil) failed sanity check, terminating stack trace! Please read http://www.mysql.com/doc/en/Using_stack_trace.html and follow instructions on how to resolve the stack trace. Resolved stack trace is much more helpful in diagnosing the problem, so please do resolve it Trying to get some variables. Some pointers may be invalid and cause the dump to abort... thd->query at 0x862c0b0 = DELETE FROM test_prepare_simple WHERE id=? thd->thread_id=1 The manual page at http://www.mysql.com/doc/en/Crashing.html contains information that should help you find out what is causing the crash. Looking at the stack trace shows: krsna:~ # resolve_stack_dump /usr/lib/mysql/mysqld.sym stacktrace.txt 0x8089167 handle_segfault + 423 0x82da818 pthread_sighandler + 184 0x8529833 __vt_4Item + 19 0x80cbb85 setup_params_data__FP12st_prep_stmt + 149 0x80cc962 mysql_stmt_execute__FP3THDPc + 274 0x8095713 dispatch_command__F19enum_server_commandP3THDPcUi + 1395 0x8095192 do_command__FP3THD + 162 0x8094907 handle_one_connection + 551 0x82d7fcc pthread_start_thread + 220 0x830b8fa thread_start + 4 From IRC: <JeremyC> well it crashed in Item::Item() This 4.1 is from RPMs, not compiled, if that's of any use. How to repeat: I compiled client_test.c as such: gcc -o client client_test.c `mysql_config --cflags` `mysql_config --libs` then simply run the binary with args needed to connect to your db. note: if I take out the lines that run the prepare statement with a placeholder, it runs until: MySQL-4.1.1-alpha-standard-log][1065] Query was empty client: client_test.c:5601: test_pure_coverage: Assertion `rc != 0' failed. Aborted And the SQL log: 1 Prepare 1 Prepare insert into test_pure(c2) values(10) But, at least this isn't restarting the server ;)