Bug #47883 Assertion `0' failed in protocol.cc:465: void net_end_statement(THD*) with PBXT
Submitted: 7 Oct 2009 1:56 Modified: 21 Oct 2009 5:14
Reporter: Elena Stepanova Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.35-debug, 5.1.39-debug, 6.0.9-debug, 5.1 bzr OS:Any
Assigned to: CPU Architecture:Any

[7 Oct 2009 1:56] Elena Stepanova
Description:
If MySQL server is built with PBXT, it has pbxt_statistics table in I_S schema. If PBXT hits the max number of threads, queries performed on the table can make the debug version of the server crash. 

See also https://bugs.launchpad.net/pbxt/+bug/441000 (for non-debug version, the crash happens on the client side).

PBXT 1.0.09d

How to repeat:
#Run the following test as
#> perl ./mysql-test-run.pl --mysqld=--pbxt_max_threads=20 pbxt_statistics_crash
#on a debug version of the server with built-in PBXT:

# pbxt_statistics_crash.test

set global event_scheduler=ON;
use test;
--disable_warnings
drop table if exists t1;
drop event if exists ev1;
drop event if exists ev2;
drop event if exists ev3;
drop event if exists ev4;
drop event if exists ev5;
--enable_warnings
create table t1 ( i int ) engine = pbxt;
delimiter //;
create event ev1 on schedule every 1 second do
        begin insert into test.t1 values (1); end//
create event ev2 on schedule every 1 second do
        begin insert into test.t1 values (2); end//
create event ev3 on schedule every 1 second do
        begin insert into test.t1 values (3); end//
create event ev4 on schedule every 1 second do
        begin insert into test.t1 values (4); end//
create event ev5 on schedule every 1 second do
        begin insert into test.t1 values (5); end//
delimiter ;//
lock tables t1 write;
select sleep(5);

connect (con2,localhost,root,,);
connection con2;

select id, Value from information_schema.pbxt_statistics order by ID;

# end of pbxt_statistics_crash.test
[7 Oct 2009 2:02] Elena Stepanova
mysqld: protocol.cc:465: void net_end_statement(THD*): Assertion `0' failed.
091007  4:43:32 - mysqld got signal 6 ;
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=1048576
read_buffer_size=131072
max_used_connections=2
max_threads=151
threads_connected=16
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 60559 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x129ad400
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...
stack_bottom = 0x418210d8 thread_stack 0x40000
/export/home/tmp/qauser/mysql-5.1.39_static_pbxt_1009d/sql/mysqld(my_print_stacktrace+0x24) [0x9bd384]
/export/home/tmp/qauser/mysql-5.1.39_static_pbxt_1009d/sql/mysqld(handle_segfault+0x322) [0x6120c2]
/lib64/libpthread.so.0 [0x33a8c0de70]
/lib64/libc.so.6(gsignal+0x35) [0x33a8030155]
/lib64/libc.so.6(abort+0x110) [0x33a8031bf0]
/lib64/libc.so.6(__assert_fail+0xf6) [0x33a80295d6]
/export/home/tmp/qauser/mysql-5.1.39_static_pbxt_1009d/sql/mysqld(net_end_statement(THD*)+0x60) [0x605d50]
/export/home/tmp/qauser/mysql-5.1.39_static_pbxt_1009d/sql/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x1f2) [0x62a2b2]
/export/home/tmp/qauser/mysql-5.1.39_static_pbxt_1009d/sql/mysqld(do_command(THD*)+0x1aa) [0x62b95a]
/export/home/tmp/qauser/mysql-5.1.39_static_pbxt_1009d/sql/mysqld(handle_one_connection+0x84c) [0x61aacc]
/lib64/libpthread.so.0 [0x33a8c062f7]
/lib64/libc.so.6(clone+0x6d) [0x33a80d1b6d]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x129b7d50 = select id, Value from information_schema.pbxt_statistics order by ID
thd->thread_id=29
thd->killed=NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file
[7 Oct 2009 7:56] Sveta Smirnova
Thank you for the report.

Please provide options you used when compiled MySQL server.
[8 Oct 2009 12:08] Elena Stepanova
./configure --with-comment=pbxt.109 --with-server-suffix=pbxt.109 --enable-thread-safe-client --enable-local-infile --with-pic --with-fast-mutexes --with-client-ldflags=-static --with-mysqld-ldflags=-static --with-zlib-dir=bundled --with-big-tables --with-ssl --with-readline --with-plugins=max-no-ndb --without-embedded-server --with-innodb --without-ndbcluster --with-pbxt --with-archive-storage-engine --with-blackhole-storage-engine --with-csv-storage-engine --without-example-storage-engine --with-federated-storage-engine--with-extra-charsets=complex CFLAGS=-g -O3 CXXFLAGS=-g -O3 --with-debug
[11 Oct 2009 13:00] Sveta Smirnova
Thank you for the feedback.

Verified as described.
[21 Oct 2009 5:14] Timothy Smith
Closing this as "Not a bug" because it is specific to a 3rd-party engine, and there is no indication that some MySQL server code is at fault.

Either a bug should be filed against PBXT, or the PBXT developers should open a MySQL Server bug with details about how the server is at fault for this problem.