Bug #51675 Server crashes on inserting 4 byte char. after ALTER TABLE to 'utf8mb4'
Submitted: 3 Mar 2010 8:18 Modified: 10 Mar 2010 9:05
Reporter: Nidhi Shrotriya Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:5.5.3-m3 OS:Any
Assigned to: CPU Architecture:Any

[3 Mar 2010 8:18] Nidhi Shrotriya
Description:
The issue is found while testing WL#1213 using 'mysql-next-mr-bar2' tree. 
WL#1213 is supposed to go in Celosia.

INSERT INTO t4_initial(subject) VALUES(x'f0909080');

ERROR 2013 (HY000): Lost connection to MySQL server during query 
100303 11:19:16 mysqld_safe Number of processes running now: 0 
100303 11:19:16 mysqld_safe mysqld restarted 
mysql> 

Stack trace from server logs:
--------------------------
stack_bottom = 0xa7cd5388 thread_stack 0x30000
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(my_print_stacktrace+0x22) [0x8531c32]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(handle_segfault+0x3ff) [0x821143f]
[0xb7fcb400]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld [0x8553f36]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(ha_key_cmp+0xe81) [0x85314f1]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(_mi_seq_search+0xfb) [0x84dda7b]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld [0x84efea5]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(_mi_ck_write_btree+0x98) [0x84f0508]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(mi_write+0x365) [0x84ef005]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(handler::ha_write_row(unsigned char*)+0x5b) [0x831959b]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(write_record(THD*, TABLE*, st_copy_info*)+0x73) [0x829a2e3]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool)+0xbc0) [0x829f8d0]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(mysql_execute_command(THD*)+0x1746) [0x8223d16]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(mysql_parse(THD*, char const*, unsigned int, char const**)+0x36e) [0x8228e1e]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0xd12) [0x8229b42]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(do_command(THD*)+0xc3) [0x822a9f3]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(do_handle_one_connection(THD*)+0x259) [0x821b929]
/home/nidhi/mysql-builds/mysql-next-mr-bar2/bin/mysqld(handle_one_connection+0x11) [0x821bc91]
/lib/tls/i686/cmov/libpthread.so.0 [0xb7fa54ff]
/lib/tls/i686/cmov/libc.so.6(clone+0x5e) [0xb7dac49e]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x93bbda0 = INSERT INTO t4_initial(subject) VALUES(x'f0909080')
thd->thread_id=1
thd->killed=NOT_KILLED

How to repeat:
SET NAMES utf8;
DROP TABLE IF EXISTS t4_initial;
CREATE TABLE t4_initial ( 
  subject varchar(255) character set utf8 collate utf8_unicode_ci, 
  p varchar(15) character set utf8 
) DEFAULT CHARSET=latin1; 

# Alter old table, add index 
ALTER TABLE t4_initial ADD INDEX (subject); 

# Alter old 'utf8' table to new 'utf8mb4' 
ALTER TABLE t4_initial 
  DEFAULT CHARACTER SET utf8, 
  MODIFY subject varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, 
  MODIFY p varchar(255) CHARACTER SET utf8; 
SHOW CREATE TABLE t4_initial; 

insert into t4_initial(subject) values('abcd'); 
# Insert 4 byte characters 
INSERT INTO t4_initial(subject) VALUES(x'f0909080');
[4 Mar 2010 11:07] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/102276
[4 Mar 2010 12:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/102296
[6 Mar 2010 10:29] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100306102742-yw9zzgw9ac5r65m5) (version source revid:bar@mysql.com-20100304132546-mg01i2tr3lbdx0n6) (merge vers: 6.0.14-alpha) (pib:16)
[6 Mar 2010 10:31] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100306102638-qna09hbjb5gm940h) (version source revid:bar@mysql.com-20100304120230-x1cz1jvfdvp0fpzt) (pib:16)
[6 Mar 2010 10:52] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:bar@mysql.com-20100304120230-x1cz1jvfdvp0fpzt) (merge vers: 5.5.99-m3) (pib:16)