Matt,
since you are using InnoDB, you cannot call server_end() and server_init()
again during the lifetime of the process. InnoDB does not clean up its
internal data structures in server_end().

Is there some special reason you would need to shut down the server and
open it again?
Regards,
Heikki
Innobase Oy
sql query
.......
===============================================
Bug report -- MySQL v4.04b, source distribution
===============================================

----------------------------------------------------------------
Machine specs (build machine and test machine are same machine):
----------------------------------------------------------------
Dell Inspiron 8200 laptop
Windows XP Professional SP1
.NET Framework SP2

------------------
Build description:
------------------
libmysqld.dll was built using Microsoft Visual C++ 6.0 SP5 and Microsoft
Visual C++ Processor Pack SP5 (used for ASM files).  We build our own
version because we need to make a change so that the DLL will work with
C# clients (see below for more info).

--------------------
Problem description:
--------------------
A C# client was built using Microsoft Visual Studio.NET.  The client
calls mysql server init(), mysql server end(), and mysql server init()
again.  On second call to mysql server init(), the exception
System.NullReferenceException is thrown.

>From an equivalent C++ program, an access violation occurs at the same
point.

Behavior is identical using debug and release builds of libmysqld.dll.

--------
C# code:
--------

using System;
using System.Runtime.InteropServices;
using System.Security;

namespace Reproduce Embedded MySQL crash
{

  class Class1
        {

    [STAThread]
                static void Main(string[] args)
                {
      MySqlAPI.ServerInit(0, null, null);
      MySqlAPI.ServerEnd();
      MySqlAPI.ServerInit(0, null, null);
      MySqlAPI.ServerEnd();
                }
        }

  class MySqlAPI
  {

    [SuppressUnmanagedCodeSecurity]
    [DllImport("libmysqld.dll",
       CharSet=System.Runtime.InteropServices.CharSet.Ansi,
       EntryPoint="mysql server init", ExactSpelling=true)]
    public static extern int ServerInit(int icArgs, string [] strArgs,
string [] strGroups);


    [DllImport("libmysqld.dll",
       EntryPoint="mysql server end", ExactSpelling=true)]
    public static extern void ServerEnd();

  }
}

---------
C++ code:
---------

/****************************************************/
/* modified from test dll.cpp that ships with MySQL */
/****************************************************/

#include "stdafx.h"
#include <winsock.h>
#include <mysql.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

const char *server groups[] = {
  "test libmysqld SERVER", "embedded", "server", NULL
};

int main(int argc, char* argv[])
{
  mysql server init(argc, argv, (char **)server groups);
  mysql server end();
  mysql server init(argc, argv, (char **)server groups);
  mysql server end();

  return 0;
}


---------------
MySQL binaries:
---------------
Upon request, I can supply our debug and release builds of
libmysqld.dll.

-------------------------------
Source code change description:
-------------------------------
There is only one change we make to the MySQL 4.04b source distribution.
We define USE TLS for the "mysys" project.  The reason is that it's
required for clients that use LoadLibrary(), which includes all C#
clients.  More information can be found in the VC++ documentation
article "Rules and Limitations for TLS".

-----------------------
My contact information:
-----------------------
Matt Solnit <[EMAIL PROTECTED]>




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to