Bug #42520 killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
Submitted: 1 Feb 2009 16:56 Modified: 8 Jan 2010 21:08
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:6.0.9-debug,6.0.10,5.5 OS:Any
Assigned to: Alexey Botchkov
Tags: crash, KILL, pushbuild, sporadic, test failure
Triage: Triaged: D1 (Critical)

[1 Feb 2009 16:56] Shane Bester
Description:
killing a load xml infile statement misway causes debug assertion:

mysqld-debug.exe!_NMSG_WRITE()[crt0msg.c:198]
mysqld-debug.exe!abort()[abort.c:59]
mysqld-debug.exe!_wassert()[assert.c:212]
mysqld-debug.exe!Diagnostics_area::set_ok_status()[sql_error.cc:86]
mysqld-debug.exe!my_ok()[sql_class.h:2269]
mysqld-debug.exe!mysql_load()[sql_load.cc:553]
mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:3397]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:5735]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1007]
mysqld-debug.exe!do_command()[sql_parse.cc:690]
mysqld-debug.exe!handle_one_connection()[sql_connect.cc:1145]
mysqld-debug.exe!pthread_start()[my_winthread.c:61]
mysqld-debug.exe!_callthreadstartex()[threadex.c:348]
mysqld-debug.exe!_threadstartex()[threadex.c:331]
kernel32.dll!FlsSetValue()

thd->query at 195D6F48=LOAD XML LOCAL INFILE 'e:/setup.exe' INTO TABLE tabl
thd->thread_id=14
thd->killed=KILL_CONNECTION

How to repeat:
LOAD XML LOCAL INFILE 'any large file' INTO TABLE `any table` ROWS IDENTIFIED BY '<person>'

in another session kill the above statement.
[4 Feb 2009 9:23] Sveta Smirnova
Thank you for the report.

Verified as described on Mac.
[4 Aug 2009 8:47] Sveta Smirnova
Same on 64-bit Linux:

Test:

create table t1(f1 text);

--let $PSEUDO_THREAD_ID=`select @@pseudo_thread_id    `

--send LOAD XML LOCAL INFILE '$HOME/hostname/changes.xml'  INTO TABLE t1 ROWS IDENTIFIED BY '<person>'

sleep 3;

connect (addconroot, localhost, root,,);
connection addconroot;

show processlist;

--eval kill $PSEUDO_THREAD_ID

Where you downloaded changes.xml as described in previous comment.

Trace:

stack_bottom = 0x40a820d8 thread_stack 0x40000
/users/ssmirnova/blade12/src/mysql-azalea/sql/mysqld(my_print_stacktrace+0x35) [0xb49ffc]
/users/ssmirnova/blade12/src/mysql-azalea/sql/mysqld(handle_segfault+0x2a7) [0x6bf49e]
/lib64/libpthread.so.0 [0x3429e0dd40]
/lib64/libc.so.6(gsignal+0x35) [0x3429230015]
/lib64/libc.so.6(abort+0x110) [0x3429231980]
/lib64/libc.so.6(__assert_fail+0xf6) [0x3429229726]
/users/ssmirnova/blade12/src/mysql-azalea/sql/mysqld(Diagnostics_area::set_ok_status(THD*, unsigned long long, unsigned long long, char const*)+0x60) [0x793982]
/users/ssmirnova/blade12/src/mysql-azalea/sql/mysqld(my_ok(THD*, unsigned long long, unsigned long long, char const*)+0x42) [0x5cea70]
/users/ssmirnova/blade12/src/mysql-azalea/sql/mysqld(mysql_load(THD*, sql_exchange*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool)+0x1586) [0x856024]
/users/ssmirnova/blade12/src/mysql-azalea/sql/mysqld(mysql_execute_command(THD*)+0x46f7) [0x6d4948]
/users/ssmirnova/blade12/src/mysql-azalea/sql/mysqld(mysql_parse(THD*, char const*, unsigned int, char const**)+0x287) [0x6db7e1]
/users/ssmirnova/blade12/src/mysql-azalea/sql/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0xaf0) [0x6ce51f]
/users/ssmirnova/blade12/src/mysql-azalea/sql/mysqld(do_command(THD*)+0x252) [0x6cd81a]
/users/ssmirnova/blade12/src/mysql-azalea/sql/mysqld(handle_one_connection+0x14c) [0x6cbfe6]
/lib64/libpthread.so.0 [0x3429e061b5]
/lib64/libc.so.6(clone+0x6d) [0x34292cd39d]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x1a9e95d0 = LOAD XML LOCAL INFILE '$HOME/hostname/changes.xml'  INTO TABLE t1 ROWS IDENTIFIED BY '<person>'
thd->thread_id=2
thd->killed=KILL_CONNECTION
[4 Aug 2009 11:42] 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/79998

2841 Alexey Botchkov	2009-08-04
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
          if the error happens in the my_b_get function, it's not handled by the READ_INFO::read_xml
          function. It's just treaten as an EOF, which is not always so.
          The check thd->is_error() added.
      
      per-file comments:
        mysql-test/r/loadxml.result
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
           test result updated
      
        mysql-test/t/loadxml.test
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
        sql/sql_load.cc
          test case added.
      
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
          thd->is_error() check added for the errors in net reading functions.
[21 Aug 2009 11:21] Alexander Barkov
http://lists.mysql.com/commits/79998 looks Ok to push.
[2 Nov 2009 15:43] Tor Didriksen
This is still flaky, fails sporadically in gcov and valgrind builds
(which are compiled with EXTRA_DEBUG I guess).
See e.g.
http://pb2.norway.sun.com/web.py?action=archive_download&archive_id=895694&pretty=please
http://pb2.norway.sun.com/web.py?action=archive_download&archive_id=896774&pretty=please

Easy to reproduce, simply run the test back-to-back until it fails.
./mtr --valgrind-mysqld  loadxml && ./mtr --valgrind-mysqld  loadxml && ....
[9 Nov 2009 18:12] 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/89849

2945 Alexey Botchkov	2009-11-09
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
         The additional patch. That 'loadxml.test' failure was actually about our testing system,
         not the code.
         Firstly we need a new mysqltest command, wich i called 'send_eval'. So the expression
         can be evaluated, then started in a parallel thread. We only have separane 'send' and
         'eval' commands at the moment.
         Then we need to add the waiting code after the 'KILL' to our test, so the thread will be killed
         before the test goes further. The present 'reap' command doesn't handle the killed threads
         well.
      
      per-file comments:
        client/mysqltest.cc
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
          The 'send_eval' command implemented.
      
        mysql-test/r/loadxml.result
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
         test result updated.
      
        mysql-test/t/loadxml.test
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
         test case added.
[10 Nov 2009 8:58] 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/89897

2945 Alexey Botchkov	2009-11-10
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
         The additional patch. That 'loadxml.test' failure was actually about our testing system,
         not the code.
         Firstly we need a new mysqltest command, wich i called 'send_eval'. So the expression
         can be evaluated, then started in a parallel thread. We only have separane 'send' and
         'eval' commands at the moment.
         Then we need to add the waiting code after the 'KILL' to our test, so the thread will be killed
         before the test goes further. The present 'reap' command doesn't handle the killed threads
         well.
      
      per-file comments:
        client/mysqltest.cc
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
          The 'send_eval' command implemented.
      
        mysql-test/r/loadxml.result
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
         test result updated.
      
        mysql-test/t/loadxml.test
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
         test case added.
[11 Nov 2009 8:47] 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/90058

2916 Alexey Botchkov	2009-11-11
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
         The additional patch. That 'loadxml.test' failure was actually about our testing system,
         not the code.
         Firstly we need a new mysqltest command, wich i called 'send_eval'. So the expression
         can be evaluated, then started in a parallel thread. We only have separane 'send' and
         'eval' commands at the moment.
         Then we need to add the waiting code after the 'KILL' to our test, so the thread will be killed
         before the test goes further. The present 'reap' command doesn't handle the killed threads
         well.
            
      per-file comments:
        client/mysqltest.cc
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
          The 'send_eval' command implemented.
      
        mysql-test/r/loadxml.result
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
         test result updated.
      
        mysql-test/t/loadxml.test
      Bug#42520      killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
         test case added.
[11 Nov 2009 13:05] Alexey Botchkov
the additional fix pushed into mysql-next-mr-alik
[8 Jan 2010 21:08] Paul Dubois
Noted in 5.5.1 changelog.

In debug builds, killing a LOAD XML INFILE statement raised an
assertion.
[23 Feb 2010 2:06] Paul Dubois
Addition to changelog entry:

Implemented in the course of fixing this bug, mysqltest has a new
send_eval command that combines the functionality of the existing
send and eval commands.