Bug #75870 void String::chop(): Assertion `strlen(m_ptr) == m_length' failed

Submitted: 12 Feb 2015 8:43 Modified: 14 Jul 2015 6:51
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Logging Severity:S2 (Serious)
Version:5.7.5-m15 OS:Any
Assigned to: CPU Architecture:Any

[12 Feb 2015 8:43] Roel Van de Paar
Description:
(gdb) bt
#0  0x00007f63db581771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000e15cd8 in my_write_core (sig=6) at /bzr/testbuild/mysql-5.7.5-m15_dbg/mysys/stacktrace.c:247
#2  0x0000000000822044 in handle_fatal_signal (sig=6) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/signal_handler.cc:219
#3  <signal handler called>
#4  0x00007f63da1855c9 in raise () from /lib64/libc.so.6
#5  0x00007f63da186cd8 in abort () from /lib64/libc.so.6
#6  0x00007f63da17e536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007f63da17e5e2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000000bca910 in String::chop (this=0x7f63dbaf5770) at /bzr/testbuild/mysql-5.7.5-m15_dbg/include/sql_string.h:320
#9  0x0000000000bb9806 in mysql_rm_table_no_locks (thd=0x7f628a81c000, tables=0x7f628a827998, if_exists=true, drop_temporary=false, drop_view=false,dont_log_query=false) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_table.cc:2664
#10 0x0000000000bb8422 in mysql_rm_table (thd=0x7f628a81c000, tables=0x7f628a827998, if_exists=1 '\001', drop_temporary=0 '\000') at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_table.cc:2167
#11 0x0000000000b4a966 in mysql_execute_command (thd=0x7f628a81c000) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_parse.cc:3585
#12 0x0000000000b4fcc1 in mysql_parse (thd=0x7f628a81c000, parser_state=0x7f63dbaf6e60) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_parse.cc:5427
#13 0x0000000000b44814 in dispatch_command (command=COM_QUERY, thd=0x7f628a81c000, packet=0x7f628a833011 "DROP TABLE IF EXISTS `\217\355?\355?\355\335`;", packet_length=33) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_parse.cc:1250
#14 0x0000000000b4354d in do_command (thd=0x7f628a81c000) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/sql_parse.cc:834
#15 0x0000000000c4d4ce in handle_connection (arg=0x7f63bd3fff60) at /bzr/testbuild/mysql-5.7.5-m15_dbg/sql/conn_handler/connection_handler_per_thread.cc:298
#16 0x0000000000e394b8 in pfs_spawn_thread (arg=0x7f63bdbf9410) at /bzr/testbuild/mysql-5.7.5-m15_dbg/storage/perfschema/pfs.cc:2137
#17 0x00007f63db57cdf3 in start_thread () from /lib64/libpthread.so.0
#18 0x00007f63da2461ad in clone () from /lib64/libc.so.6

How to repeat:
$ vi {epoch}_mybase     # Update base path in this file (the only change required!)
$ ./{epoch}_init        # Initializes the data dir
$ ./{epoch}_start       # Starts mysqld
$ ./{epoch}_cl          # To check mysqld is up
$ ./{epoch}_run_pquery  # Run the testcase (produces output)
$ vi /dev/shm/{epoch}/error.log.out  # Verify the error log
$ ./{epoch}_gdb         # Brings you to a gdb prompt attached to correct mysqld & generated core
$ ./{epoch}_parse_core  # Create {epoch}_STD.gdb and {epoch}_FULL.gdb; standard and full var gdb stack traces
etc.

Note you must use _run_pquery... C++ based replay causes this issue. Standard CLI execution does not.
[12 Feb 2015 8:47] Roel Van de Paar
Tarball with all scripts required

Attachment: bug_75870.tar.gz (application/gzip, text), 93.55 KiB.

[12 Feb 2015 9:44] Shane Bester
to verifier: please check if testcase does similar to mine:
Bug 20444737 - STRING::CHOP ASSERTS ON NAUGHTY TABLE NAMES
[12 Feb 2015 9:52] Roel Van de Paar
I see you try to keep the humor up too!
[12 Feb 2015 9:56] Roel Van de Paar
SELECT 'ĢŎˆΓƠŘ̋ˇĮŦ̕̕_ȘĦĀŃĚ'
[12 Feb 2015 10:00] Roel Van de Paar
Lol; put the above in a txt file, and execute it using --binary-mode, it cannot handle it...

mysql> source ~/testcase_sb.txt
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??S' at line 1
[12 Feb 2015 11:55] Shane Bester
to make a simple testcase for this one i also had "fun".
ended up using a php script, basically doing:

$s='64726f702074656d706f72617279207.....';
$binstr=pack("H*",$s);
mysqli_real_query($link,$binstr)
[14 Jul 2015 6:51] Erlend Dahl
Fixed in 5.7.8, 5.8.0 under the heading of Bug#20444737 STRING::CHOP ASSERTS ON NAUGHTY TABLE NAMES

[29 Jun 2015 14:25] Paul Dubois

Noted in 5.7.8, 5.8.0 changelogs.

Incorrect calculation of the length of strings written to the binary
log could raise an assertion or cause a server exit.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.057 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.