Bug #816 MySQL Server shuts down abnormally
Submitted: 8 Jul 2003 22:08 Modified: 11 Feb 2004 6:53
Reporter: mirunalini sethuraman Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.0.13 OS:Windows (Win 95)
Assigned to: CPU Architecture:Any

[8 Jul 2003 22:08] mirunalini sethuraman
Description:
Queries & Results:
select count(*) from trnlbthdr
Result:
13847
delete from trnlbthr

For the above query MySQL server closed abnormally.
The message in the mysql server window was:
	C:\mysql\bin>mysqld-max --console
	030625  9:24:12  InnoDB: Started
	C:\MYSQL\BIN\MYSQLD~2.EXE: ready for connections
	InnoDB: Assertion failure in thread 4290908875 in file C:\get\innobase\row\row0i
	ns.c line 509
	InnoDB: We intentionally generate a memory trap.
	InnoDB: Send a detailed bug report to mysql@lists.mysql.com
	InnoDB: Thread 4291024191 stopped in file C:\get\innobase\os\os0sync.c line 140
	InnoDB: Thread 4291019967 stopped in file C:\get\innobase\sync\sync0arr.c line 1
	26
	
	
	MYSQLD-MAX caused an invalid page fault in
	module MYSQLD-MAX.EXE at 014f:00502f5e.
	Registers:
	EAX=0000003c CS=014f EIP=00502f5e EFLGS=00010206
	EBX=00000000 SS=0157 ESP=099fe9dc EBP=0252e85c
	ECX=0000001e DS=0157 ESI=00000001 FS=38c7
	EDX=00000000 ES=0157 EDI=06c680ce GS=0000
	Bytes at CS:EIP:
	8b 02 83 c4 24 85 c0 74 15 c7 05 d4 49 5f 00 00 
	Stack dump:
	005dfe40 005b923c 005dfe40 005b927c 005dfe40 005b92b0 ffc212cb 005bf778 000001fd 0252e85c 0252e02c 02526c5c 0252675c 02526d5c 00000005 02526d5c 

Then i performed deletion using where condition.
Found the reason for the previous error was a single record.

After that if i start the server i get the error msg:
	MYSQLD caused an invalid page fault in
	module KERNEL32.DLL at 015f:bff89266.
	Registers:
	EAX=00000000 CS=015f EIP=bff89266 EFLGS=00010202
	EBX=009afe28 SS=0167 ESP=009af32c EBP=009af350
	ECX=bff89263 DS=0167 ESI=00880030 FS=17df
	EDX=bffc9490 ES=0167 EDI=0072c860 GS=0000
	Bytes at CS:EIP:
	8b 40 18 85 c0 74 06 50 e8 7c cf ff ff 8b 75 08 
	Stack dump:
	0072c860 00880030 009afe28 009af32c 009af15c 009af554 bffbfe14 bff79200 ffffffff 009af3b8 bff8abfd 00000000 00000000 0051c365 00880030 0072c860 
and the server abnormally shuts down.

Suggestions needed 
1.What is the reason for the error?
2.How to rectify?
3.Is there any limit of records for deletion?

How to repeat:
Create huge number of records in a table.
and try to delete using DELETE command.
[9 Jul 2003 1:13] Heikki Tuuri
Hi!

You are not running 4.0.13, because there is no assertion in that on line 519 of row0ins.c.

Please upgrade to 4.0.13 and post here the full .err log from a crash. Do not cut or omit anything.

Your table is only 14 000 rows. InnoDB should delete without problems millions of rows.

Regards,

Heikki
[9 Jul 2003 1:26] Heikki Tuuri
Hi!

Also show your my.cnf and the table CREATE statement. What row causes the crash?

Regards,

Heikki
[10 Jul 2003 10:24] mirunalini sethuraman
that was the error message i got in 3.23.47 version.
i got exactly the same message in 4.0.13.
but those messages wasn't available in .err file in data folder.
and also after i got the error i was not able to start the server(though i start it shut down & PC hangs)
then i reinstalled.
[10 Jul 2003 10:33] mirunalini sethuraman
my.cnf content

[WinMySQLAdmin]
Server=C:/mysql/bin/mysqld.exe
user=admin
password=admin

[mysqld]
basedir=C:/mysql
datadir=C:/mysql/data
port=3306
innodb_data_file_path = ibdata1:50M;ibdata2:50M:autoextend
innodb_data_home_dir = c:/mysql/ibdata
innodb_log_group_home_dir = c:/mysql/iblogs
innodb_log_arch_dir = c:/mysql/iblogs
set-variable = innodb_mirrored_log_groups=1
set-variable = innodb_log_files_in_group=3
set-variable = innodb_log_file_size=20M
set-variable = innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
innodb_log_archive=0
set-variable = innodb_buffer_pool_size=70M
set-variable = innodb_additional_mem_pool_size=10M
set-variable = innodb_file_io_threads=4
set-variable = innodb_lock_wait_timeout=50
[23 Jul 2003 9:42] MySQL Verification Team
I would like to do a test about your case, could you
please send me at least your table structure ?
(mysqldump.exe does the service). I would prefer if
possible with data also.
You can put it into a zipped file and upload it at:

ftp://support.mysql.com/pub/mysql/secret/

the name of the file should have a reference for this
bug report number e.g: dump-table-bug816.zip

Thanks you in advance.
[23 Jul 2003 10:05] Heikki Tuuri
Hi!

The failing assertion is this in foreign key checks:

        /* Scan index records and check if there is a matching record */

        for (;;) {
                rec = btr_pcur_get_rec(&pcur);

                if (rec == page_get_infimum_rec(buf_frame_align(rec))) {

                        goto next_rec;
                }

                if (rec == page_get_supremum_rec(buf_frame_align(rec))) {

                        err = row_ins_set_shared_rec_lock(LOCK_ORDINARY, rec,
                                                        check_index, thr);
                        if (err != DB_SUCCESS) {

                                break;
                        }

                        goto next_rec;
                }

                cmp = cmp_dtuple_rec(entry, rec);

                ...

                if (cmp < 0) {
                        err = row_ins_set_shared_rec_lock(LOCK_GAP,
                                                rec, check_index, thr);
                        if (err != DB_SUCCESS) {

                                break;
                        }

                        if (check_ref) {
                                err = DB_NO_REFERENCED_ROW;
                                row_ins_foreign_report_add_err(
                                                thr, foreign, rec, entry);
                        } else {
                                err = DB_SUCCESS;
                        }

                        break;
                }

                ut_a(cmp == 0);

The assertion can fail if records are in a wrong order in the index, that is, the table is corrupt.

What is the table CREATE statement and what are the CREATE statements for the tables associated with this through foreign key constraints? What does CHECK TABLE say about these tables?

If you dump the tables and reimport them to 4.0.14, do you still get the assertion?

Regards,

Heikki
[26 Jul 2003 2:03] mirunalini sethuraman
SCRIPT IS FOR CREATING THE WHOLE DB.THE TABLE ACTUALLY TO BE CHECKED IS 'trnlbtdtls'

Attachment: DB_SCRIPT-BUG816.txt (text/plain), 35.07 KiB.

[11 Feb 2004 6:53] Heikki Tuuri
Hi!

Changing the status to 'no feedback'. There have not been similar assertion failure reports since this report.

Regards,

Heikki