Bug #55143 Failing assertion: copied_len < local_len + extern_len
Submitted: 10 Jul 2010 0:14 Modified: 25 Apr 2012 13:26
Reporter: Vince Cox Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S1 (Critical)
Version:5.0.72,5.1.40 OS:Linux (CentOS 5.4 64 bit)
Assigned to: CPU Architecture:Any

[10 Jul 2010 0:14] Vince Cox
Description:
We had 2 server crashes,one on  7/2/2010 and one on 7/6/2010.  Since then the Master server had the problem listed below and the slave had to be promoted.

Rows 2081 - 2114 in the application table seem to be damaged.

When a query is run: select * from Application;   or mysqloptimize is run against that same table we get the following.

100707 14:05:06  InnoDB: Assertion failure in thread 1173285184 in file btr/btr0cur.c line 3814

InnoDB: Failing assertion: copied_len < local_len + extern_len

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/refman/5.1/en/forcing-recovery.html

InnoDB: about forcing recovery.

100707 14:05:06 - mysqld got signal 11 ;

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=8384512

read_buffer_size=131072

max_used_connections=2

max_threads=500

threads_connected=2

It is possible that mysqld could use up to

key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 8269273 K

bytes of memory

Hope that's ok; if not, decrease some variables in the equation.

 

thd: 0x1db05a70

Attempting backtrace. You can use the following information to find out

where mysqld died. If you see no messages after this, something went

terribly wrong...

stack_bottom = 0x45eee118 thread_stack 0x30000

/opt/mysql/bin/mysqld(my_print_stacktrace+0x20) [0xa051cc]

/opt/mysql/bin/mysqld(handle_segfault+0x368) [0x603740]

/lib64/libpthread.so.0 [0x3ab820e7c0]

/opt/mysql/bin/mysqld(btr_rec_copy_externally_stored_field+0x3b2) [0x841d8a]

/opt/mysql/bin/mysqld [0x9278dc]

/opt/mysql/bin/mysqld(row_search_for_mysql+0x1f6a) [0x924bf4]

/opt/mysql/bin/mysqld(ha_innobase::rnd_next(unsigned char*)+0x3d7) [0x839b19]

/opt/mysql/bin/mysqld(rr_sequential(st_read_record*)+0x1a) [0x73cd28]

/opt/mysql/bin/mysqld(sub_select(JOIN*, st_join_table*, bool)+0xbc) [0x690c26]

/opt/mysql/bin/mysqld [0x690779]

/opt/mysql/bin/mysqld(JOIN::exec()+0x1b05) [0x68b365]

/opt/mysql/bin/mysqld(mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*)+0x18b) [0x66f8db]

/opt/mysql/bin/mysqld(handle_select(THD*, st_lex*, select_result*, unsigned long)+0x16c) [0x69813c]

/opt/mysql/bin/mysqld [0x619c68]

/opt/mysql/bin/mysqld(mysql_execute_command(THD*)+0x4b30) [0x613e6c]

/opt/mysql/bin/mysqld(mysql_parse(THD*, char const*, unsigned int, char const**)+0x20a) [0x61a1fe]

/opt/mysql/bin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x1350) [0x60e7e8]

/opt/mysql/bin/mysqld(do_command(THD*)+0x114) [0x60d494]

/opt/mysql/bin/mysqld(handle_one_connection+0xd34) [0x608850]

/lib64/libpthread.so.0 [0x3ab82064a7]

/lib64/libc.so.6(clone+0x6d) [0x3ab76d3c2d]

Trying to get some variables.

Some pointers may be invalid and cause the dump to abort...

thd->query at 0x1dafb220 = select * from Application

thd->thread_id=3

thd->killed=NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains

information that should help you find out what is causing the crash.

100707 14:05:06 mysqld_safe Number of processes running now: 0

100707 14:05:06 mysqld_safe mysqld restarted

100707 14:05:06 [Note] Plugin 'FEDERATED' is disabled.

100707 14:05:06 [Warning] option 'innodb-autoextend-increment': unsigned value 104857600 adjusted to 1000

InnoDB: The log sequence number in ibdata files does not match

InnoDB: the log sequence number in the ib_logfiles!

100707 14:05:07  InnoDB: Database was not shut down normally!

InnoDB: Starting crash recovery.

InnoDB: Reading tablespace information from the .ibd files...

InnoDB: Restoring possible half-written data pages from the doublewrite

InnoDB: buffer...

InnoDB: Last MySQL binlog file position 0 430778, file name ./mysql-bin.000101

100707 14:05:08  InnoDB: Started; log sequence number 32 1051951390

100707 14:05:08 [Note] Recovering after a crash using mysql-bin

100707 14:05:08 [Note] Starting crash recovery...

100707 14:05:08 [Note] Crash recovery finished.

100707 14:05:08 [Note] Event Scheduler: Loaded 0 events

100707 14:05:08 [Note] /opt/mysql/bin/mysqld: ready for connections.

Version: '5.1.40-enterprise-gpl-advanced-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Enterprise Server - Advanced Edition (GPL)

================================================

If select col1, col2 ... col5, from Applications where SystemId='2081'; All columns can be pulled from the table.  but not using select * from application;

Server crashes frequently.  Severe impact to customer base.

How to repeat:
run select * from Application;   or mysqloptimize
[10 Jul 2010 0:17] Vince Cox
Initial breakdown of core dump using gdb

Attachment: linux_gdb_from core_dump.txt (text/plain), 3.82 KiB.

[10 Jul 2010 0:18] Vince Cox
Backtrace from Initial Core Dump Text File

Attachment: Linux_gdb_core_dump_full_backtrace.txt (text/plain), 29.70 KiB.

[10 Jul 2010 0:20] Vince Cox
Mysql error file after crash

Attachment: Mysql_server_log_file_after_crash.txt (text/plain), 74.68 KiB.

[10 Jul 2010 6:01] Valeriy Kravchuk
Can this be related to some hardware failure? Please, check OS logs.

We had a couple of similar bug reports in the past, but nobody ever came up with a repeatable test case.
[11 Jul 2010 15:58] Vince Cox
Valeriy,

This issue has been produced on various hardware platforms running linux. It's been on physical hosts, vm's as well as blade servers in a chassis. And I've already cleared the hardware platform it's running on now. We also ran memtest, it ran for several hours and came back clean.

-Vince
[12 Jul 2010 6:20] Sveta Smirnova
Thank you for the feedback.

Could you please send us dump of problem table of output of SHOW CREATE TABLE and SHOW TABLE STATUS for problem table? Please send us your configuration file also.
[12 Jul 2010 19:36] Vince Cox
Show create table and show table status output

Attachment: show_table _and _show_create_table.txt (text/plain), 54.33 KiB.

[12 Jul 2010 19:37] Vince Cox
New attachment added.  The output from the 2 commands are in the textfile.
[13 Jul 2010 7:27] Sveta Smirnova
Thank you for the feedback.

I can not repeat described behavior.

> We had 2 server crashes,one on  7/2/2010 and one on 7/6/2010.  Since then the Master
server had the problem listed below and the slave had to be promoted.

Probably table is corrupted, although InnoDB should fix this at startup anyway. What CHECK TABLE Applications prints?

> This issue has been produced on various hardware platforms running linux.

How do you produce this issue? Can you create repeatable test case?
[13 Jul 2010 15:54] Vince Cox
I can cause this failure be running either select * from Application;

or

by running mysqloptimize against the table.

I will get you that other data that you requested.
[13 Jul 2010 17:24] Vince Cox
mysql> use  prodCEMIC
Database changed
Here is the output of the check table command that you requested.

-Vince

mysql> check table Application;
+-----------------------+-------+----------+----------+
| Table                 | Op    | Msg_type | Msg_text |
+-----------------------+-------+----------+----------+
| prodCEMIC.Application | check | status   | OK       |
+-----------------------+-------+----------+----------+
1 row in set (0.41 sec)

mysql>
[13 Jul 2010 19:38] Sveta Smirnova
Thank you for the feedback.

> I can cause this failure be running either select * from Application;
> or
> by running mysqloptimize against the table.

Problem is I can not repeat crash with test data. So something different should be in your setup if you are able to recreate the problem on different machines.

How do you move table to another machine? Do you use mysqldump or moving binary files?

Please also try current version 5.1.48: probably problem solved already by fix of another bug.
[14 Jul 2010 0:39] Vince Cox
We move data between the systems using mysqldump. I can use a working table (Applications)from another server. Drop table on broken server.  Add table and import data and it works.

If I then restore Broken DB from backup it 's in the back in the broken state.

We are trying to figure out what keeps causing this. That's the reason I've sent all of the stack/backtraces.

Thanks.

-Vince
[21 Jul 2010 19:05] Vince Cox
Are you able to get any information from the backtraces that were sent?
[21 Jul 2010 20:25] MySQL Verification Team
Vince, mysqldump/import is not enough to be sure all corruption is gone.  You need to start with a totally new innodb tablespace (ibdata* and ib_log*). This means mysqldump/reload all innodb tables...

The error log contained one "*** glibc detected" which usually means some memory was corrupted elsewhere, which might be a sign of the problem.

I wrote a better random data generator that does insert/select/update/delete on this table, but it still doesn't repeat a problem here.. Can you upload a my.cnf?
[21 Jul 2010 20:28] MySQL Verification Team
my testcase to try repeat it. only run on a test server (it uses real table name!)

Attachment: bug55143.php (application/octet-stream, text), 7.54 KiB.

[30 Jul 2010 21:10] Vince Cox
Below is the my.cnf file that you requested.

# The following options will be passed to all MySQL clients
[client]
port					= 3306
socket					= /var/lib/mysql/mysql.sock
user					= root

# The MySQL server
[mysqld]
port					= 3306
basedir					= /opt/mysql
datadir					= /var/lib/mysql
tmpdir					= /var/tmp
socket					= /var/lib/mysql/mysql.sock
user					= mysql
skip-federated
back_log				= 50
max_connections				= 500
max_connect_errors			= 10
table_cache				= 2048
max_allowed_packet			= 32M
binlog_cache_size			= 1M
max_heap_table_size			= 64M
sort_buffer_size			= 16M
join_buffer_size			= 16M
thread_cache_size			= 8

# Try number of CPU's*2 for thread_concurrency
thread_concurrency			= 8
query_cache_size			= 64M
query_cache_limit			= 2M
ft_min_word_len				= 4
# See SF case #8103
# memlock
default_table_type			= INNODB
thread_stack				= 192K
transaction_isolation 			= READ-COMMITTED
tmp_table_size				= 128M

# Enable the full query log. Every query (even ones 
# with incorrect syntax) that the server receives will 
# be logged. This is useful for debugging, it is 
# usually disabled in production use. 
## log
log_warnings
slow_query_log
slow_query_log_file			= mysql-slow.log
long-query-time = 5
log_long_format
log-error				= mysql.err
pid-file				= mysql.pid

# Replication Setup
########################
log-bin					= mysql-bin
log-bin-index 				= mysql-bin.index
binlog_format				= mixed
expire_logs_days			= 14
# server-id needs to be unique on each replication server
server-id				= 3
# relay-log statements apply only to slave servers
relay-log				= mysql-relay-bin
relay-log-index				= mysql-relay-index
relay-log-info-file			= mysql-relay-log.info

# only SUPER and 
# read-only

slave_load_tmpdir			= /tmp
tmpdir					= /tmp

innodb_additional_mem_pool_size		= 4M
innodb_buffer_pool_size			= 4G
innodb_file_per_table			= 1
# Where to put the ibdata (default: datadir)
# innodb_data_home_dir
# How to create the ibdata
innodb_data_file_path			= "ibdata1:100M:autoextend"
# ibdata growth step
innodb_autoextend_increment		= 100M
innodb_thread_concurrency		= 8
innodb_flush_log_at_trx_commit		= 1
innodb_flush_method			= O_DIRECT
# Global buffer for transaction# assembly before commit
innodb_log_buffer_size			= 4M
# Size of one ib_logfile
innodb_log_file_size			= 256M
# Number of ib_logfile?
innodb_log_files_in_group		= 3
# Percentage of buffer pool pages that
# may be dirty before forcing a checkpoint
innodb_max_dirty_pages_pct		= 90
innodb_lock_wait_timeout		= 120

## Added for Innovation kw.
interactive_timeout			= 432000
wait_timeout				= 432000

[mysqldump]
quick
max_allowed_packet			= 32M

[mysql]
no-auto-rehash

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
open-files-limit			= 8192
[5 Aug 2010 18:50] Vince Cox
We have not had any crashes recently, but we really would like to know what the cause if this is. Is has occurred in several environments, and they all stop abruptly. And we end up promoting the slave. We can't keep going on like this. Any advice on what we need to do at this point?

Thanks.

-Vince
[9 Aug 2010 20:57] Sveta Smirnova
Thank you for the feedback.

I still can not repeat the problem using Shane's test case and options provided.

Please check your RAM and if it is OK please try current version 5.1.49: we continuously fix bugs and this can be fixed already.
[9 Sep 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[8 Oct 2010 15:32] MySQL Verification Team
i got this with random blob testing on 5.0.72.

101008 17:25:54InnoDB: Assertion failure in thread 1804 in file .\btr\btr0cur.c line 3788
InnoDB: Failing assertion: copied_len < local_len + extern_len

ntdll.dll!RtlUnicodeToMultiByteSize()
mysqld-debug.exe!_free_base()[free.c:103]
mysqld-debug.exe!_free_dbg_lk()[dbgheap.c:1207]
mysqld-debug.exe!_free_dbg()[dbgheap.c:1070]
mysqld-debug.exe!free()[dbgheap.c:1025]
mysqld-debug.exe!ut_free()[ut0mem.c:236]
mysqld-debug.exe!mem_area_free()[mem0pool.c:464]
mysqld-debug.exe!mem_heap_block_free()[mem0mem.c:317]
mysqld-debug.exe!mem_heap_free_func()[mem0mem.ic:472]
mysqld-debug.exe!row_vers_impl_x_locked_off_kernel()[row0vers.c:249]
mysqld-debug.exe!lock_sec_rec_some_has_impl_off_kernel()[lock0lock.c:1696]
mysqld-debug.exe!lock_rec_convert_impl_to_expl()[lock0lock.c:4892]
mysqld-debug.exe!lock_sec_rec_read_check_and_lock()[lock0lock.c:5073]
mysqld-debug.exe!sel_set_rec_lock()[row0sel.c:785]
mysqld-debug.exe!row_search_for_mysql()[row0sel.c:3784]
mysqld-debug.exe!ha_innobase::index_read()[ha_innodb.cc:3879]
mysqld-debug.exe!ha_innobase::index_first()[ha_innodb.cc:4130]
mysqld-debug.exe!handler::read_range_first()[handler.cc:2664]
mysqld-debug.exe!handler::read_multi_range_first()[handler.cc:2542]
mysqld-debug.exe!QUICK_RANGE_SELECT::get_next()[opt_range.cc:6991]
mysqld-debug.exe!rr_quick()[records.cc:261]
mysqld-debug.exe!mysql_update()[sql_update.cc:460]
mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:3589]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:6266]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1938]
mysqld-debug.exe!do_command()[sql_parse.cc:1628]
mysqld-debug.exe!handle_one_connection()[sql_parse.cc:1234]
mysqld-debug.exe!pthread_start()[my_winthread.c:85]
mysqld-debug.exe!_threadstart()[thread.c:196]
kernel32.dll!FlsSetValue()
[10 May 2011 13:03] Karsten Brusch
Hello Everyone,

we are facing a similar problem with a DB which restarts every ~20 minutes while under load.
There is one massive LONGBLOB which seems to cause the crash. It stores Slavic text mainly.

May 10 06:42:22 <hostname> mysqld[7916]: 110510  6:42:22InnoDB: Assertion failure in thread 729971632 in file btr0cur.c line 3781
May 10 06:42:22 <hostname> mysqld[7916]: InnoDB: Failing assertion: copied_len == local_len + extern_len

When running a select on the table the DB crashes and restarts.
Unfortunately I cannot send the content of that dataset because the server even crashes when performing mysqldump and the ibdata is >20GB. "Check table" returns OK for me as well.

 CREATE TABLE `tablename` (
  `id` int(11) NOT NULL,
  `column2` varchar(250) character set latin1 collate latin1_bin default NULL,
  `column3` longblob,
  `column4` int(11) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

We found that truncating the table made the error go away once, but it came back later (after App filled it with new data).
Affected version is: 5.0.32 on "Linux 2.6.18-6-686-bigmem i686 GNU/Linux"

We're going to run some tests with 5.5.11 and see if it shows up again.
I'll keep you posted.

Vince, were there any useful findings in your setup?

Cheers K.
[25 Mar 2012 13:26] Valeriy Kravchuk
I wonder if this assertion still happens to somebody on recent server versions (5.1.62 or 5.5.22).
[26 Apr 2012 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".