Bug #65073 Mysql Embedded Server fails to start under Windows
Submitted: 23 Apr 2012 12:04 Modified: 6 Jul 2012 17:51
Reporter: Carlos Quiros Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S3 (Non-critical)
Version:5.5.23 OS:Windows (XP SP3+)
Assigned to: CPU Architecture:Any
Tags: libmysqld fails start windows

[23 Apr 2012 12:04] Carlos Quiros

I have a custom program that start the Mysql Embedded Server using libmysqld.

********This is the code that starts the Embedded server: ********************
static char *server_options[] = \
        { (char *)"mysql_test",
          (char *)"--datadir=C:/ILRI/",       
          (char *)"--innodb=OFF",        
          (char *)"--default-storage-engine=MyISAM",
          (char *)"--skip-grant-tables=1",
          (char *)"--myisam-recover=FORCE",
          (char *)"--key_buffer_size=256217728", //16777216 //
          (char *)"--character-set-server=utf8",
          (char *)"--collation-server=utf8_bin",
          NULL };

        int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;

        qDebug() << "Elems: " << num_elements;

        mysql_library_init(num_elements, server_options, NULL);
        m_mysql = mysql_init(NULL);

        int valopt;
        valopt = 1;
        if (mysql_options(m_mysql,MYSQL_OPT_LOCAL_INFILE,(void *)&valopt))
            qDebug() << "Error setting option";

        mysql_real_connect(m_mysql, NULL,NULL,NULL, "database1", 0,NULL,0);


*******************************end of code******************************

The same code works fine in Linux with the same version of libmysqld (replacing --datadir with an existing path), but in Windows the embedded server creates an .err file with the following content:

mysql_embedded: Unknown error 1146
120412 12:54:45 InnoDB: The InnoDB memory heap is disabled
120412 12:54:45 InnoDB: Mutexes and rw_locks use Windows interlocked functions
120412 12:54:45 InnoDB: Compressed tables use zlib 1.2.3
120412 12:54:46 InnoDB: Initializing buffer pool, size = 128.0M
120412 12:54:46 InnoDB: Completed initialization of buffer pool
120412 12:54:46  InnoDB: Operating system error number 3 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: File name C:\ILRI\GOBLET\tools\goblet-createdb\data\ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.

As you can see in the server options I have --innodb=OFF so I don't know the InnoDB errors.

mysql_library_init is the one creating the error file. And the program exist

I tried many different settings to make it work but the embedded server just not start in windows, as I said the same code works flawlessly in Linux with the same version of libmysql, this I am filling this bug report.



How to repeat:
Happens all the time with the supplied code.
[23 Apr 2012 14:51] MySQL Verification Team
Are you tried the server_options: --defaults-file=path_for_my.ini ?.
[27 Apr 2012 15:41] Carlos Quiros

I managed to load the embedded server. Under windows it is necessary to indicate basedir.

Now another problem arises: the embedded server crashes when executing "LOAD DATA LOCAL INFILE 'C:/ILRI/GOBLET/tools/goblet-createdb/debug\test.csv' INTO TABLE testupload"

The same code does not crash in Linux.

Might this be related to bug 49694? http://bugs.mysql.com/bug.php?id=49694

Should I file a new bug report for this?

[30 Apr 2012 12:51] Carlos Quiros
I managed to trace the problem. It seem to happen when the infile in the call has c++ scape sequences.

I construct the local infile instruction in the code appending an infile variable. In my test the local infile was: c:/temp/test.csv. Because Windows uses back-slash /t was detected by libmysqld as a horizontal tab. Using mingw the sql driver was able produce an error (file not found), using visual c++ 2010 libmysqld crash.

I replaced all \ to / and all works fine.

[3 Jun 2012 15:44] Valeriy Kravchuk
So, do you still think there is some valid libmysqld-specific bug or documentation request here?
[4 Jun 2012 6:27] Carlos Quiros

There are three issues in this bug report:

1. Under windows it is necessary to indicate basedir.
   This might require to update the documentation

2. Under Windows a string containing \t (for example c:\temp) is recognized as a horizontal tab.
   This is a bug that might need correction.

3. Due to 2. libmysqld crashes using nmake (Visual Studio) but not using mingw-make (mingw).
   It might be worthy to check this difference.

Should I report each of them separately?

[5 Jun 2012 19:21] Sveta Smirnova
Thank you for the feedback.

Please provide complete test case for 2. Probably better to have separate bug and leave this for 1.
[6 Jul 2012 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[6 Jul 2012 17:51] Sveta Smirnova
As no feedback was provided verifying only basedir issue: no proper error message is printed into error output, therefore this should be either documented, or, better, fixed: accurate error message should be in the log file.