Bug #42719 LOAD XML crashes debug build
Submitted: 10 Feb 2009 2:05 Modified: 12 Feb 2009 0:20
Reporter: Tatiana Azundris Nuernberg Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: XML functions Severity:S3 (Non-critical)
Version:6.0.10 OS:Linux (x64-debug)
Assigned to: Assigned Account CPU Architecture:Any

[10 Feb 2009 2:05] Tatiana Azundris Nuernberg
Description:
LOAD XML crashed for me on 64-bit debug build.
This happens while trying to print debug messages.
LOAD XML debug msgs use %i in format string which
apparently isn't supported in my_vsnprintf.c;
%d should presumably be used instead.

%i is presumably skipped in format string,
meaning that format and args get out of step.
Hilarity ensues.

How to repeat:
*** use debug build ***

(using file from
curl -O "http://boss.yahooapis.com/ysearch/web/v1/donkeys?format=xml&appid=TX6b4XHV34EnPXW0sYEr51hP..."
but that hardly matters)

CREATE TABLE newtry ( fname VARCHAR(255) NULL);
LOAD XML LOCAL INFILE "donkeys.xml" INTO TABLE newtry ROWS IDENTIFIED BY "<url>";

Yes, I know the canonical form would be
CREATE TABLE t1 ( url VARCHAR(255) NULL );
LOAD XML LOCAL INFILE "donkeys.xml" INTO TABLE t1 ROWS IDENTIFIED BY "<result>";
SELECT * FROM t1; 
The above form was supplied by user on IRC, but problem should show and throw in either form, anyway.

Suggested fix:
Change
DBUG_PRINT(..., (" %i
to
DBUG_PRINT(..., (" %d
[12 Feb 2009 0:20] MySQL Verification Team
Thank you for the bug report. Verified as described.

c:\dbs>c:\dbs\6.0\bin\mysql -uroot --port=3600 --prompt="mysql 6.0 > "
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 6.0.10-alpha-Win x64 bzr revno 2722-debug-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql 6.0 > use test
Database changed
mysql 6.0 > LOAD XML LOCAL INFILE "c:/dbs/6.0/data/donkeys.xml" INTO TABLE newtry ROWS IDENTIFIED BY "<url>";
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql 6.0 >

thd: 0x3e59330
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...
00000001409EA032    mysqld.exe!strnlen()[strlen_s.c:45]
00000001406227EB    mysqld.exe!my_vsnprintf()[my_vsnprintf.c:119]
00000001405E4CE4    mysqld.exe!DbugFprintf()[dbug.c:1361]
00000001405E4C46    mysqld.exe!_db_doprnt_()[dbug.c:1347]
00000001403068CD    mysqld.exe!READ_INFO::read_xml()[sql_load.cc:1825]
00000001403025F9    mysqld.exe!read_xml_field()[sql_load.cc:942]
0000000140300B06    mysqld.exe!mysql_load()[sql_load.cc:425]
0000000140311993    mysqld.exe!mysql_execute_command()[sql_parse.cc:3406]
000000014031941B    mysqld.exe!mysql_parse()[sql_parse.cc:5751]
000000014030B92F    mysqld.exe!dispatch_command()[sql_parse.cc:1011]
000000014030AF48    mysqld.exe!do_command()[sql_parse.cc:691]
000000014046CB06    mysqld.exe!handle_one_connection()[sql_connect.cc:1146]
000000014058B40B    mysqld.exe!pthread_start()[my_winthread.c:62]
00000001409E4705    mysqld.exe!_callthreadstartex()[threadex.c:348]
00000001409E46D4    mysqld.exe!_threadstartex()[threadex.c:331]
00000000778F495D    kernel32.dll!BaseThreadInitThunk()
0000000077AF8791    ntdll.dll!RtlUserThreadStart()
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0000000003D91728=LOAD XML LOCAL INFILE "c:/dbs/6.0/data/donkeys.xml" INTO TABLE newtry ROWS IDENTIFIED BY "<url>"
thd->thread_id=1
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.

c:\dbs>