Bug #38339 MTR crashes if a query is executed after --send and before --reap
Submitted: 24 Jul 2008 9:56 Modified: 12 May 2011 10:54
Reporter: Rafal Somla Email Updates:
Status: Duplicate Impact on me:
None 
Category:Tests: System Severity:S4 (Feature request)
Version:6.0.7-alpha-debug-log OS:Any
Assigned to: CPU Architecture:Any
Tags: pushbuild, sporadic, test failure, widespread

[24 Jul 2008 9:56] Rafal Somla
Description:
If, in a test script, after doing "--send <quer>" another query is executed, things get confused resulting in a crash of mysqltest application. MTR reports:

ERROR: mysqltest returned unexpected code 134, it has probably crashed

I would expect a more informative error message. Ideally, mysqltest should not crash but detect and report the problem. 

Alternatively, the error log of mysqltest could be shown by MTR so that one can guess what was the reason of the crash (note that the log contains stack trace).

How to repeat:
Execute the following test script:

--send SELECT sleep(1)
SET FOO=bar;
--reap

It leads to a crash of mysqltest. The error log of mysqltest shows:

CURRENT_TEST: main.bug
Error: Packets out of order (Found: 1, expected 6)
lt-mysqltest: net.c:906: my_real_read: Assertion `0' failed.
mysqltest got signal 6
read_command_buf at 0x8073f00 = --reap
conn->name at 0x8129080 = 
Attempting backtrace...
stack_bottom = (nil) thread_stack 0x10000
/ext/mysql/bzr/mysql-6.0/client/.libs/lt-mysqltest(my_print_stacktrace+0x26)[0x805d90f]
/ext/mysql/bzr/mysql-6.0/client/.libs/lt-mysqltest[0x8058ff1]
/ext/mysql/bzr/mysql-6.0/client/.libs/lt-mysqltest[0x805901b]
[0xffffe420]
/lib/tls/libc.so.6(abort+0x109)[0x403f20c9]
/lib/tls/libc.so.6(__assert_fail+0x10f)[0x403ea05f]
//ext/mysql/bzr/mysql-6.0/libmysql_r/.libs/libmysqlclient_r.so.16[0x401c1f0d]
//ext/mysql/bzr/mysql-6.0/libmysql_r/.libs/libmysqlclient_r.so.16(my_net_read+0x34)[0x401c2067]
//ext/mysql/bzr/mysql-6.0/libmysql_r/.libs/libmysqlclient_r.so.16(cli_safe_read+0x33)[0x401b54f0]
//ext/mysql/bzr/mysql-6.0/libmysql_r/.libs/libmysqlclient_r.so.16[0x401ba595]
//ext/mysql/bzr/mysql-6.0/libmysql_r/.libs/libmysqlclient_r.so.16(mysql_read_query_result+0x19)[0x4016e814]
/ext/mysql/bzr/mysql-6.0/client/.libs/lt-mysqltest(run_query_normal+0x138)[0x8057443]
/ext/mysql/bzr/mysql-6.0/client/.libs/lt-mysqltest(run_query+0x579)[0x8058804]
/ext/mysql/bzr/mysql-6.0/client/.libs/lt-mysqltest(main+0xafd)[0x8059c3f]
/lib/tls/libc.so.6(__libc_start_main+0xc8)[0x403dcea8]
/ext/mysql/bzr/mysql-6.0/client/.libs/lt-mysqltest[0x804ca91]

Examining core file with gdb shows this call stack:

#2  0x403ea05f in __assert_fail () from /lib/tls/libc.so.6
#3  0x401c1f0d in my_real_read (net=0x80f4340, complen=0xbfffd4f8) at net.c:906
#4  0x401c2067 in my_net_read (net=0x80f4340) at net.c:992
#5  0x401b54f0 in cli_safe_read (mysql=0x80f4340) at client.c:673
#6  0x401ba595 in cli_read_query_result (mysql=0x80f4340) at client.c:2702
#7  0x4016e814 in mysql_read_query_result (mysql=0x80f4340) at libmysql.c:4841
#8  0x08057443 in run_query_normal (cn=0x80f4340, command=0x813c7c8, flags=2, query=0x812a2d0 "reap", query_len=4, ds=0x8112d40, ds_warnings=0xbfffd6b8) at mysqltest.c:6044
#9  0x08058804 in run_query (cn=0x80f4340, command=0x813c7c8, flags=2) at mysqltest.c:6751
#10 0x08059c3f in main (argc=20, argv=0xbfffda74) at mysqltest.c:7375

And the place where assertion fails is:

901                 fflush(stdout);
902                 fprintf(stderr,"Error: Packets out of order (Found: %d, expected %d)\n",
903                         (int) net->buff[net->where_b + 3],
904                         (uint) (uchar) net->pkt_nr);
905                 fflush(stderr);
906                 DBUG_ASSERT(0);
907     #endif
908               }
909               len= packet_error;
910               /* Not a NET error on the client. XXX: why? */
[24 Jul 2008 11:54] Susanne Ebrecht
Rafal,

sorry, I don't understand this feature request exactly.

perror 134
MySQL error code 134: Record was already deleted (or record file crashed)

What exactly do you mean here?
[24 Jul 2008 12:42] Rafal Somla
What I mean is that when you execute the 3 line test script with MTR it will fail and MTR will print this message:

 ERROR: mysqltest returned unexpected code 134, it has probably crashed

So this means that mysqltest returned error code 134 which has probably nothing to do with error codes reported by perror (you can ask Magnus).
[28 Jul 2008 11:49] Alexander Nozdrin
Feedback has been provided -- moving to Open.

I believe, this must be a P1 *bug* (not feature request),
because we see *lots* of messages like this from mtr,
and it makes life really difficult.
[12 May 2011 10:54] Bjørn Munch
Duplicate Bug #49269 has been fixed.