Bug #84754 void String::chop(): Assertion `strlen(m_ptr) == m_length' failed.
Submitted: 31 Jan 2017 19:35 Modified: 1 Feb 2017 6:00
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: XA transactions Severity:S6 (Debug Builds)
Version:5.7.16, 5.7.17 OS:Any
Assigned to: CPU Architecture:Any

[31 Jan 2017 19:35] Roel Van de Paar
Description:
2017-01-31T19:13:58.440680Z 0 [Note] /sda/MS151116-mysql-5.7.16-linux-x86_64-debug/bin/mysqld: ready for connections.
Version: '5.7.16-debug'  socket: '/sda/MS151116-mysql-5.7.16-linux-x86_64-debug/socket.sock'  port: 19199  MySQL Community Server (GPL)
mysqld: /git/mysql-server_dbg/include/sql_string.h:320: void String::chop(): Assertion `strlen(m_ptr) == m_length' failed.
19:14:05 UTC - mysqld got signal 6 ;

Core was generated by `/sda/MS151116-mysql-5.7.16-linux-x86_64-debug/bin/mysqld --no-defaults --core-f'.
Program terminated with signal 6, Aborted.
#0  0x00007f99d0467741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
61        val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
(gdb) bt
#0  0x00007f99d0467741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000001822fb0 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.c:247
#2  0x0000000000e7457c in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007f99ce7fb1d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f99ce7fc8c8 in __GI_abort () at abort.c:90
#6  0x00007f99ce7f4146 in __assert_fail_base (fmt=0x7f99ce9453a8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x1e9568b "strlen(m_ptr) == m_length",
    file=file@entry=0x1e95660 "/git/mysql-server_dbg/include/sql_string.h", line=line@entry=320,
    function=function@entry=0x1e95b10 <String::chop()::__PRETTY_FUNCTION__> "void String::chop()") at assert.c:92
#7  0x00007f99ce7f41f2 in __GI___assert_fail (assertion=0x1e9568b "strlen(m_ptr) == m_length", file=0x1e95660 "/git/mysql-server_dbg/include/sql_string.h", line=320,
    function=0x1e95b10 <String::chop()::__PRETTY_FUNCTION__> "void String::chop()") at assert.c:101
#8  0x000000000142ca8a in String::chop (this=0x7f99d0a58e90) at /git/mysql-server_dbg/include/sql_string.h:320
#9  0x000000000142baa9 in Transaction_state_tracker::store (this=0x7f99a4831080, thd=0x7f99a4819000, buf=...) at /git/mysql-server_dbg/sql/session_tracker.cc:1185
#10 0x000000000142c521 in Session_tracker::store (this=0x7f99a481c678, thd=0x7f99a4819000, buf=...) at /git/mysql-server_dbg/sql/session_tracker.cc:1667
#11 0x0000000001418c32 in net_send_ok (thd=0x7f99a4819000, server_status=16387, statement_warn_count=0, affected_rows=0, id=0, message=0x7f99a481be00 "", eof_identifier=false)
    at /git/mysql-server_dbg/sql/protocol_classic.cc:346
#12 0x000000000141951c in Protocol_classic::send_ok (this=0x7f99a481a198, server_status=3, statement_warn_count=0, affected_rows=0, last_insert_id=0, message=0x7f99a481be00 "")
    at /git/mysql-server_dbg/sql/protocol_classic.cc:643
#13 0x0000000001498529 in THD::send_statement_status (this=0x7f99a4819000) at /git/mysql-server_dbg/sql/sql_class.cc:4694
#14 0x00000000014f035b in dispatch_command (thd=0x7f99a4819000, com_data=0x7f99d0a59cb0, command=COM_QUERY) at /git/mysql-server_dbg/sql/sql_parse.cc:1843
#15 0x00000000014ede33 in do_command (thd=0x7f99a4819000) at /git/mysql-server_dbg/sql/sql_parse.cc:995
#16 0x000000000161d370 in handle_connection (arg=0x7f99b4fe9840) at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:300
#17 0x000000000184f79c in pfs_spawn_thread (arg=0x7f99b4e76020) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2188
#18 0x00007f99d0462dc5 in start_thread (arg=0x7f99d0a5a700) at pthread_create.c:308
#19 0x00007f99ce8bd73d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
DROP DATABASE test;
set @@collation_connection=utf16_czech_ci;
SET SESSION session_track_transaction_info=2;
xa start 'a','a';
[31 Jan 2017 19:37] Roel Van de Paar
See bug 75870 and bug 79905
[1 Feb 2017 6:00] Umesh Shastry
Hello Roel,

Thank you for the report.
Observed that 5.7.17 debug build is affected.

Thanks,
Umesh