[CONC-74] crash while executing load data local infile Created: 2014-02-06  Updated: 2014-02-06  Resolved: 2014-02-06

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Sudhindra Bhat Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None
Environment:

rev 114


Issue Links:
Relates
relates to CONC-75 load data local fails with "load data... Closed

 Description   

sample call stack:

 	00000000()	
>	mariadb_test.exe!mysql_handle_local_infile(st_mysql * conn, const char * filename)  Line 298 + 0x11 bytes	C
 	mariadb_test.exe!mthd_my_read_query_result(st_mysql * mysql)  Line 2264 + 0xd bytes	C
 	mariadb_test.exe!mysql_real_query(st_mysql * mysql, const char * query, unsigned long length)  Line 2303 + 0x25 bytes	C

sample test case:

static int test_conc71edited(MYSQL *my)
{
  int rc;
  MYSQL_RES *res;
  MYSQL_ROW row;
  char *query;
  MYSQL *mysql;
  /* uncomment if you want to test manually */
  //return SKIP;
 
  mysql= mysql_init(NULL);
 
  mysql_options(mysql, MYSQL_OPT_RECONNECT,(const char *)"true");
  mysql_options(mysql, MYSQL_SET_CHARSET_NAME, "utf8");
  mysql_options(mysql, MYSQL_OPT_COMPRESS, 0);
  mysql_options(mysql, MYSQL_INIT_COMMAND, "/*!40101 SET SQL_MODE='' */");
  mysql_options(mysql, MYSQL_INIT_COMMAND, "/*!40101 set @@session.wait_timeout=28800 */");
 
 
  mysql_real_connect(mysql, hostname, username, password, schema, port, socketname, 0| CLIENT_MULTI_RESULTS | CLIENT_REMEMBER_OPTIONS);
  //diag("kill server");
  //sleep(20);
 // restarting the server here after mysql_real_connect
 
 
 // the crash is due to local_infile_end function pointer being NULL
 // options.client_flag = 0 at the case where it crashes
 // mysql_set_local_infile_default is not called before line 242 in mysql_handle_local_infile()
 //check for all callback functions exist MUST happen before a CALL
 
 
  rc= mysql_query(mysql, "load data local infile 'C:\\Users\\abc\\Desktop\\nonexistingfile.csv' into table `test`.`a` (`a`)");
  puts(mysql_error(mysql));
  rc= mysql_query(mysql, "load data local infile 'C:\\Users\\abc\\Desktop\\nonexistingfile.csv' into table `test`.`a` (`a`)");
  puts(mysql_error(mysql));
  rc= mysql_query(mysql, "load data local infile 'C:\\Users\\abc\\Desktop\\nonexistingfile.csv' into table `test`.`a` (`a`)");
  puts(mysql_error(mysql));
  //rc= mysql_query(mysql, "SELECT 'foo' FROM DUAL");
  //check_mysql_rc(rc, mysql);
 
  mysql_close(mysql);
  return OK;
}



 Comments   
Comment by Sudhindra Bhat [ 2014-02-06 ]

The test case has lost indentation after posting here.

Comment by Georg Richter [ 2014-02-06 ]

Fixed in rev. 116

Generated at Thu Feb 08 03:02:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.