Assertion `!str || str != Ptr' failed in in String::copy | sql/sql_string.cc:345

Bug #1429039 reported by Ramesh Sivaraman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.1
Won't Fix
Undecided
Unassigned
5.5
Invalid
Undecided
Unassigned
5.6
Invalid
High
Unassigned
5.7
Invalid
High
Unassigned

Bug Description

** Testcase

DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t1(a TEXT CHARACTER SET cp1251)SELECT _koi8r'�����' AS a;
ALTER TABLE t1 ADD COLUMN c INT;
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
ALTER TABLE t1 ADD c2 BLOB;
ALTER TABLE t1 engine=memory;
ALTER TABLE t1 ADD INDEX c2f(c22f),CHANGE c2 c22f INT;
LOCK TABLE t1 write;
alter table t1 convert to character set ucs2 collate ucs2_czech_ci;
SELECT * FROM t1;
SELECT * FROM t1;

Could not reproduce the issue with normal reduction steps. Modified reduction script to reproduce the error.

The attached tarball gives the testcase as an exact match of our system, including some handy utilities
$ vi {epoch}_mybase # Update base path in this file (the only change
required!)
$ ./{epoch}_reproduce # this will reproduce the issue.
$ ./{epoch}_parse_core # Create {epoch}_STD.gdb and {epoch}_FULL.gdb;
standard and full var gdb stack traces

** GDB info

#0 0x00007f39ac086771 in pthread_kill () from /lib64/libpthread.so.0
#1 0x0000000000abb48e in my_write_core (sig=6) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-7
2.0/mysys/stacktrace.c:422
#2 0x00000000007312c3 in handle_fatal_signal (sig=6) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.
6.23-72.0/sql/signal_handler.cc:236
#3 <signal handler called>
#4 0x00007f39aac8a5c9 in raise () from /lib64/libc.so.6
#5 0x00007f39aac8bcd8 in abort () from /lib64/libc.so.6
#6 0x00007f39aac83536 in __assert_fail_base () from /lib64/libc.so.6
#7 0x00007f39aac835e2 in __assert_fail () from /lib64/libc.so.6
#8 0x00000000008479f2 in String::copy (this=0x33ef5a0, str=0x7f395803ee30 "\002X?", arg_length=512, from_cs=0x17bd500 <my_charset_ucs2_czech_uca_ci>,
 to_cs=0x17254e0 <my_charset_latin1>, errors=0x7f39a43c8ea4) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-se
rver-5.6.23-72.0/sql/sql_string.cc:345
#9 0x000000000072732a in Protocol::net_store_data (this=0x33ef4a0, from=0x7f395803ee30 "\002X?", length=512, from_cs=0x17bd500 <my_charset_ucs2_czech
_uca_ci>, to_cs=0x17254e0 <my_charset_latin1>) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72
.0/sql/protocol.cc:100
#10 0x00000000007292d3 in Protocol::store_string_aux (this=0x33ef4a0, from=0x7f395803ee30 "\002X?", length=512, fromcs=0x17bd500 <my_charset_ucs2_czec
h_uca_ci>, tocs=0x17254e0 <my_charset_latin1>) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72
.0/sql/protocol.cc:958
#11 0x0000000000729dab in Protocol_text::store (this=0x33ef4a0, field=0x7f3958010020) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_
exp/centos6-64/percona-server-5.6.23-72.0/sql/protocol.cc:1121
#12 0x0000000000669bad in Item_field::send (this=0x7f3958005cf0, protocol=0x33ef4a0, buffer=0x7f39a43c92e0) at /mnt/workspace/percona-server-5.6-binar
ies-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/item.cc:7034
#13 0x0000000000728f02 in Protocol::send_result_set_row (this=0x33ef4a0, row_items=0x33f1cf0) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/protocol.cc:847
#14 0x000000000079b239 in select_send::send_data (this=0x7f3958005888, items=...) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_class.cc:2721
#15 0x00000000007b7fb6 in end_send (join=0x7f39580058b0, join_tab=0x7f3958006c60, end_of_records=false) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_executor.cc:2786
#16 0x00000000007b53e6 in evaluate_join_record (join=0x7f39580058b0, join_tab=0x7f3958006960) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_executor.cc:1601
#17 0x00000000007b49c8 in sub_select (join=0x7f39580058b0, join_tab=0x7f3958006960, end_of_records=false) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_executor.cc:1276
#18 0x00000000007b4295 in do_select (join=0x7f39580058b0) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_executor.cc:933
#19 0x00000000007b21f1 in JOIN::exec (this=0x7f39580058b0) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_executor.cc:194
#20 0x0000000000815f7b in mysql_execute_select (thd=0x33eef70, select_lex=0x33f1bd0, free_join=true) at /mnt/workspace/percona-server-5.6-binaries-deb
ug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_select.cc:1100
#21 0x0000000000816277 in mysql_select (thd=0x33eef70, tables=0x7f3958005270, wild_num=1, fields=..., conds=0x0, order=0x33f1d98, group=0x33f1cd0, having=0x0, select_options=2149845760, result=0x7f3958005888, unit=0x33f1588, select_lex=0x33f1bd0) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_select.cc:1221
#22 0x0000000000814306 in handle_select (thd=0x33eef70, result=0x7f3958005888, setup_tables_done_option=0) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_select.cc:110
#23 0x00000000007ec317 in execute_sqlcom_select (thd=0x33eef70, all_tables=0x7f3958005270) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_parse.cc:5634
#24 0x00000000007e480e in mysql_execute_command (thd=0x33eef70) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_parse.cc:2989
#25 0x00000000007ef059 in mysql_parse (thd=0x33eef70, rawbuf=0x7f3958005080 "SELECT * FROM t1", length=16, parser_state=0x7f39a43cae30) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_parse.cc:6922
#26 0x00000000007e0ecf in dispatch_command (command=COM_QUERY, thd=0x33eef70, packet=0x3bd5171 "", packet_length=17) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_parse.cc:1434
#27 0x00000000007dfded in do_command (thd=0x33eef70) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_parse.cc:1051
#28 0x00000000007a7d0d in do_handle_one_connection (thd_arg=0x33eef70) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_connect.cc:1532
#29 0x00000000007a7815 in handle_one_connection (arg=0x33eef70) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/sql/sql_connect.cc:1443
#30 0x0000000000dcc8c0 in pfs_spawn_thread (arg=0x3b8fdb0) at /mnt/workspace/percona-server-5.6-binaries-debug-yassl/label_exp/centos6-64/percona-server-5.6.23-72.0/storage/perfschema/pfs.cc:1860
#31 0x00007f39ac081df3 in start_thread () from /lib64/libpthread.so.0
#32 0x00007f39aad4b1ad in clone () from /lib64/libc.so.6

Tags: qa
Revision history for this message
Ramesh Sivaraman (rameshvs02) wrote :
Revision history for this message
Roel Van de Paar (roel11) wrote :
Download full text (4.0 KiB)

To Ramesh:
1) There is a bug in the script somewhere:

2015-03-07 10:19:57 22888 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.22-70.1 started; log sequence number 0
/sda/percona-5.6.22-71.0-linux-x86_64-debug/bin/mysqld: Too many arguments (first extra is '/sda/percona-5.6.22-71.0-linux-x86_64-debug/mysql-5.6.22-71.0-linux-x86_64-debug/scripts/mysql_install_db'). <------
Use --verbose --help to get a list of available options
2015-03-07 10:19:57 22888 [ERROR] Aborting

Because of this the replay fails.

To Laurynas:
2) When testing (after (1) above is fixed) using 1425625176_reproduce after setting path in 1425625176_mybase, make sure to use 5.6 not 5.7 as 5.7 client lib names are different (pquery will not find them)
3) Even without the reproduce script, just using the sql testcase (with SOURCE command in CLI), it is clear that something is amiss; the output for MS is this;

+------------+------+------+------+
| a | c | c22f | c2 |
+------------+------+------+------+
| ????? | NULL | NULL | NULL |
+------------+------+------+------+
1 row in set (0.00 sec)

+------------+------+------+------+
| a | c | c22f | c2 |
+------------+------+------+------+
| ????? | NULL | NULL | NULL |
+------------+------+------+------+
1 row in set (0.00 sec)

Whilst the output for PS is this;

+-----------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------+------+------+
| a
                                                                                                      | c | c22f |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------+------+------+
| ?????
                                                                                                      | NULL | NULL |
| uuABCDEFGHIGKLMNOPRSTUVWXYZ?bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | 3 | NULL |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------+------+------+
2 rows in set (0.00 sec)

+-----------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------+------+------+
| a
                                                                                                      | c | c22f |
+------------------------------------------------------------------------------...

Read more...

Revision history for this message
Ramesh Sivaraman (rameshvs02) wrote :

Hi Roel,

I was able to reproduce issue in my local machine without any issue using same bundle bundle. PFA reduction log

Could you please provide "bash -x 1425625176_reproduce" ouput

Revision history for this message
Roel Van de Paar (roel11) wrote :

I found the bug, it happens when there are 2x mysql_install_db inside a basedir;

+ MID='/sda/percona-5.6.22-71.0-linux-x86_64-debug/scripts/mysql_install_db
/sda/percona-5.6.22-71.0-linux-x86_64-debug/mysql-5.6.22-71.0-linux-x86_64-debug/scripts/mysql_install_db'

A solution would be to maybe add

| head -n1

To the mysql_install_db find command for the {epoch} scripts generation from reducer?

Revision history for this message
Roel Van de Paar (roel11) wrote :

Fixed in reducer.sh, randgen rev 1137, by the following addition to the find commands; -maxdepth 2 for both mysqld and mysql_install_db. Ramesh, would you check that this still works for non-create_binary_distrubtion builds? Thanks

Revision history for this message
Roel Van de Paar (roel11) wrote :

@Laurynas; the testcase should work as posted, unless you had something like basedir\sub-basedir, which is unlikely

Revision history for this message
Ramesh Sivaraman (rameshvs02) wrote :

Hi Roel,

1425625176_reproduce is not working with non-create_binary_distrubtion builds. Created 1425625176_mtr_reproduce script to reproduce the issue with mysql-test-run tool. We can use this script for non-create_binary_distrubtion builds.

Please find the attached bundle

Revision history for this message
Ramesh Sivaraman (rameshvs02) wrote :

Hi Laurynas,

Please use modified script 1425625176_mtr_reproduce (once off use of MTR) to reproduce this issue.

PFA modified script in #7.

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

This is not an upstream bug, is it?

Revision history for this message
Ramesh Sivaraman (rameshvs02) wrote :

Could not reproduce the issue with upstream (5.6.29). Issue is also not reproduced with PS 5.6.28 version. I think we can close this ticket

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-880

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.