Bug #52512 Assertion `! is_set()' in Diagnostics_area::set_ok_status on LOAD DATA
Submitted: 31 Mar 2010 19:46 Modified: 12 Jan 2011 10:10
Reporter: Elena Stepanova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.1.42-debug, 5.5.3-m3-debug OS:Any
Assigned to: Georgi Kodinov CPU Architecture:Any
Triage: Needs Triage: D1 (Critical)

[31 Mar 2010 19:46] Elena Stepanova
Description:
Is also reproducible on 5.6.99-m4-debug, it did not fit into the Version field.

#3  <signal handler called>
#4  0x00002b5ef67a8bb5 in raise () from /lib64/libc.so.6
#5  0x00002b5ef67a9fb0 in abort () from /lib64/libc.so.6
#6  0x00002b5ef67a2286 in __assert_fail () from /lib64/libc.so.6
#7  0x0000000000699995 in Diagnostics_area::set_ok_status (this=0x169c238, thd=0x16997e0, affected_rows_arg=0, last_insert_id_arg=0, 
    message_arg=0x44888880 "Records: 0  Deleted: 0  Skipped: 0  Warnings: 1") at sql_error.h:65
#8  0x0000000000735dbf in mysql_load (thd=0x16997e0, ex=0x171c4a0, table_list=0x171c530, fields_vars=@0x169bbc8, set_fields=@0x169bbf8, 
    set_values=@0x169bbe0, handle_duplicates=DUP_ERROR, ignore=true, read_file_from_client=<value optimized out>) at sql_class.h:2731
#9  0x00000000006012d3 in mysql_execute_command (thd=0x16997e0) at sql_parse.cc:3360
#10 0x0000000000605e5f in mysql_parse (thd=0x16997e0, inBuf=0x171c370 "LOAD DATA LOCAL INFILE 'tb_betony_partitions_init.txt' INTO TABLE test.t_load", 
    length=77, found_semicolon=0x44889900) at sql_parse.cc:5735
#11 0x00000000005fbb59 in dispatch_command (command=COM_QUERY, thd=0x16997e0, packet=0x1714341 "", packet_length=77) at sql_class.h:672
#12 0x00000000005fb1fe in do_command (thd=0x16997e0) at sql_parse.cc:710
#13 0x00000000005f9e11 in do_handle_one_connection (thd_arg=<value optimized out>) at sql_connect.cc:1174
#14 0x00000000005f9ce3 in handle_one_connection (arg=<value optimized out>) at sql_connect.cc:1113
#15 0x0000000000930bb7 in pfs_spawn_thread (arg=<value optimized out>) at pfs.cc:1011
#16 0x00002b5ef61bd143 in start_thread () from /lib64/libpthread.so.0
#17 0x00002b5ef68398cd in clone () from /lib64/libc.so.6
#18 0x0000000000000000 in ?? ()

I have not found any open bugs for the assertion.

How to repeat:
# cat t/tst.test
# The file might exist or not, it does not make any difference.
# --send is important

CREATE TABLE test.t_load (id INT NOT NULL);
--send LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE test.t_load

#<EOF>
[6 Apr 2010 15:50] Georgi Kodinov
Here's the stack trace from a 5.1-bugteam tree compiled with BUILD/compile-pentium-debug-max :
#0  0x00000036d920c2ac in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000009eb605 in my_write_core (sig=6) at stacktrace.c:329
#2  0x0000000000661fa5 in handle_segfault (sig=6) at mysqld.cc:2571
#3  <signal handler called>
#4  0x00000036d8a326c5 in raise () from /lib64/libc.so.6
#5  0x00000036d8a33ea5 in abort () from /lib64/libc.so.6
#6  0x00000036d8a2b7b5 in __assert_fail () from /lib64/libc.so.6
#7  0x0000000000654cf5 in my_real_read (net=0x208e4a0, complen=0x7f2f36b509a8) at net_serv.cc:912
#8  0x0000000000655022 in my_net_read (net=0x208e4a0) at net_serv.cc:1005
#9  0x00000000007e3b98 in _my_b_net_read (info=0x7f2f36b51138, Buffer=0x7f2f36b50aaf "", Count=1) at mf_iocache.cc:59
#10 0x00000000009cc22b in _my_b_get (info=0x7f2f36b51138) at mf_iocache.c:1481
#11 0x00000000007e278e in READ_INFO::read_field (this=0x7f2f36b510c0) at sql_load.cc:1201
#12 0x00000000007e1853 in read_sep_field (thd=0x208e3b8, info=..., table_list=0x7f2f28008ca8, fields_vars=..., set_fields=..., set_values=..., 
    read_info=..., enclosed=..., skip_lines=0, ignore_check_option_errors=true) at sql_load.cc:881
#13 0x00000000007e04a0 in mysql_load (thd=0x208e3b8, ex=0x7f2f28008c28, table_list=0x7f2f28008ca8, fields_vars=..., set_fields=..., 
    set_values=..., handle_duplicates=DUP_ERROR, ignore=true, read_file_from_client=true) at sql_load.cc:448
#14 0x0000000000677854 in mysql_execute_command (thd=0x208e3b8) at sql_parse.cc:3459
#15 0x000000000067f0f4 in mysql_parse (thd=0x208e3b8, inBuf=0x7f2f28008b48 "LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t_load", length=49, 
    found_semicolon=0x7f2f36b52c80) at sql_parse.cc:5971
#16 0x0000000000671729 in dispatch_command (command=COM_QUERY, thd=0x208e3b8, packet=0x20e0fc9 "", packet_length=49) at sql_parse.cc:1233
#17 0x00000000006706e0 in do_command (thd=0x208e3b8) at sql_parse.cc:874
#18 0x000000000066ea35 in handle_one_connection (arg=0x208e3b8) at sql_connect.cc:1127
#19 0x00000036d9206a3a in start_thread () from /lib64/libpthread.so.0
#20 0x00000036d8ade67d in clone () from /lib64/libc.so.6
[7 Apr 2010 15:18] 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/105163

3447 Georgi Kodinov	2010-04-07
      Bug #52512: Assertion `! is_set()' in Diagnostics_area::set_ok_status 
      on LOAD DATA
      
      Two problems :
      1. LOAD DATA was not checking for SQL errors and was sending an OK
      packet even when there were errors reported already. Fixed to check for
      SQL errors in addition to the error conditions already detected.
      2. There was an over-ambitious assert() on the server to check if the 
      protocol is always followed by the client. This can cause crashes on 
      debug servers by clients not completing the protocol exchange for some
      reason (e.g. --send command in mysqltest). Fixed by keeping the assert
      only on client side, since the server always completes the protocol 
      exchange.
[17 Jun 2010 6:12] Bugs System
Pushed into 5.5.5-m3 (revid:alexey.kopytov@sun.com-20100615145247-8bj0vmuqlotbqsn9) (version source revid:georgi.kodinov@oracle.com-20100609084124-kmo69y336tc7w7ky) (merge vers: 5.5.5-m3) (pib:16)
[17 Jun 2010 6:15] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100615150216-cubqoyn1fj9b6a2p) (version source revid:alik@ibmvm-20100610103252-to5miyvcox8lnmgx) (pib:16)
[19 Jul 2010 14:34] Bugs System
Pushed into 5.1.49 (revid:build@mysql.com-20100719143034-omcma40sblwmay3x) (version source revid:georgi.kodinov@oracle.com-20100609082927-w1hfw1unm43r4b14) (merge vers: 5.1.48) (pib:16)
[21 Jul 2010 14:12] Paul Dubois
Noted in 5.1.49, 5.5.5 changelogs.

LOAD DATA INFILE did not check for SQL errors and sent an OK packet
even when errors were already reported. Also, an assert related to
client-server protocol checking in debug servers sometimes was raised
when it should not have been.
[26 Jul 2010 18:28] Paul Dubois
Closing. Changelog entry will become public when the bug report becomes public.
[23 Aug 2010 11:26] Kristofer Pettersson
SRT: Severity C, cvss: 4
[14 Oct 2010 8:39] Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.51-ndb-7.0.20 (revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:21)
[14 Oct 2010 8:54] Bugs System
Pushed into mysql-5.1-telco-6.3 5.1.51-ndb-6.3.39 (revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:21)
[14 Oct 2010 9:12] Bugs System
Pushed into mysql-5.1-telco-6.2 5.1.51-ndb-6.2.19 (revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:21)
[3 Nov 2010 15:42] Paul Dubois
CVE-2010-3683