Bug #18779 Crash on insert of UTF8 in some InnoDB tables
Submitted: 4 Apr 2006 17:35 Modified: 5 Apr 2006 0:28
Reporter: Mathieu Langlois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S1 (Critical)
Version:5.0.18 OS:Mac OS X (MacOS Server 10.4.5)
Assigned to: Heikki Tuuri CPU Architecture:Any

[4 Apr 2006 17:35] Mathieu Langlois
Description:
Under certain conditions, an insert into an InnoDB table with UTF8 fields will crash the server

Here is the log of the crash:

060404 12:28:32InnoDB: Assertion failure in thread 50750464 in file data0type.c line 69
InnoDB: Failing assertion: !(prefix_len % dtype->mbmaxlen)
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html
InnoDB: about forcing recovery.
mysqld got signal 10;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=8388600
read_buffer_size=131072
max_used_connections=3
max_connections=100
threads_connected=2
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 225791 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

How to repeat:
CREATE DATABASE `mltest` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE mltest;

CREATE TABLE `asset` (
  `id` bigint(10) NOT NULL,
  `datatypeid` bigint(10) NOT NULL,
  `val` longtext,
  `indexedval` varchar(1024) default NULL,
  PRIMARY KEY  (`id`),
  KEY `datatypeid_idx` (`datatypeid`),
  KEY `indexedval_idx` (`indexedval`(255))
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into asset values (-1, -1, 'sdfds', 'sfsd');

Suggested fix:
I switched to MyISAM and so far so good.
[4 Apr 2006 18:41] Kolbe Kegel
Hi,

I was unable to repeat this using the test case provided on the 5.0.19 standard binary on Mac OS 10.4.5.

Please provide more details about the problem including how often it occurs and more information about the "certain conditions" that you believe might effect this behavior.
[4 Apr 2006 21:50] Heikki Tuuri
Mathieu,

could it be this bug:
http://bugs.mysql.com/bug.php?id=17530
?

Did you originally define the index on a colum prefix LONGER than 255 that is shown in the SHOW CREATE TABLE?

Regards,

Heikki
[5 Apr 2006 0:28] Mathieu Langlois
Thank you Heikki, this is exactly my bug, the index was originally set for 500 characters.  I didn't find that bug because I wasn't looking for an index bug!