Guillaume Morin | 1 Aug 2002 13:35

using my_thread_* in a library

Hi folks,

I am the maintainer of NSS MySQL which is, as you may have guessed, a
nss module using MySQL as backend. It shares a mysql connection between
threads. As explained in the documentation, I use my_thread_init and
my_thread_end functions to properly manage that situation.

As you may know, a nss module provides UNIX user lookup functions such
as getgrnam. That means that basically any applications can call the nss
modules function even the ones which uses MySQL too. And there lies the
issue. Indeed, if the application follows this path :

- calls mysql_connect or mysql_thread_init
...
- calls a function like getgrnam 
- does MySQL stuff

The application will segfault since the nss module has called
my_thread_end. I do not see any solutions to this because if I remove
calls to my_thread_end I create a memory leak. I've read the source of
my_thread_init, it seems that there is no way to know if the MySQL data
was already allocated (in this case, I would not call my_thread_end).

Does anyone have an idea ? Maybe, my_thread_init should be modified to
return a special error code if the MySQL data was already allocated...

TIA.

PS: sorry if it is the wrong list, I already tried to ask on the
general list and got no answer.
(Continue reading)

Sinisa Milivojevic | 1 Aug 2002 14:10
Picon
Favicon

Re: using my_thread_* in a library

On Thu, 1 Aug 2002 13:35:38 +0200
Guillaume Morin <guillaume <at> morinfr.org> wrote:

> Hi folks,
> 
> I am the maintainer of NSS MySQL which is, as you may have guessed, a
> nss module using MySQL as backend. It shares a mysql connection between
> threads. As explained in the documentation, I use my_thread_init and
> my_thread_end functions to properly manage that situation.
> 
> As you may know, a nss module provides UNIX user lookup functions such
> as getgrnam. That means that basically any applications can call the nss
> modules function even the ones which uses MySQL too. And there lies the
> issue. Indeed, if the application follows this path :
> 
> - calls mysql_connect or mysql_thread_init
> ...
> - calls a function like getgrnam 
> - does MySQL stuff
> 
> The application will segfault since the nss module has called
> my_thread_end. I do not see any solutions to this because if I remove
> calls to my_thread_end I create a memory leak. I've read the source of
> my_thread_init, it seems that there is no way to know if the MySQL data
> was already allocated (in this case, I would not call my_thread_end).
> 
> Does anyone have an idea ? Maybe, my_thread_init should be modified to
> return a special error code if the MySQL data was already allocated...
> 
> TIA.
(Continue reading)

Sinisa | 1 Aug 2002 14:19
Picon
Favicon

bk commit into 4.0 tree

Below is the list of changes that have just been committed into a
4.0 repository of Sinisa. When Sinisa does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet <at> 1.1138, 2002-08-01 15:19:06+03:00, Sinisa <at> sinisa.nasamreza.org
  few small fixes

  BitKeeper/etc/ignore
    1.125 02/08/01 15:19:04 Sinisa <at> sinisa.nasamreza.org +1 -0
    Added mysys/ste5KbMa to the ignore list

  include/my_semaphore.h
    1.4 02/08/01 15:19:04 Sinisa <at> sinisa.nasamreza.org +2 -2
    A small fix for BSDi

  sql/sql_update.cc
    1.59 02/08/01 15:19:04 Sinisa <at> sinisa.nasamreza.org +1 -1
    Just a proper error message

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	Sinisa
# Host:	sinisa.nasamreza.org
# Root:	/mnt/work/mysql-4.0

--- 1.58/sql/sql_update.cc	Tue Jul 23 18:31:18 2002
(Continue reading)

Guillaume Morin | 1 Aug 2002 14:52

Re: using my_thread_* in a library

Dans un message du 01 Aug à 15:10, Sinisa Milivojevic écrivait :
> The answer depends very much on the version of MySQL C API that you
> are using.

I code for soname "10", ie. Mysql 3.23.x C API. I really do not know if
there is another kind of versionning.

> It also depens on your application.
> But for multi-threaded applications you have to call mysql_init and
> mysql_thread_init at start and mysql_thread_ned at the end of each of
> your threads.

I think I was kinda unclear, sorry for that. I code the nss module.
Therefore, I have to find a solution for all applications. I chose to
call my_pthread_end at the end of the NSS functions of the module (I of
course call my_thread_init at the beginning of the functions).

But some apps which uses the client library such as the MySQL server itself 
calls the functions you've mentionned, then calls a NSS lookup function
(which will do a my_thread_init and my_pthread_end) and then uses some
other MySQL C functions again which will make the app segfault since
my_pthread_end has been called.

If I remove the calls to my_pthread_end in the NSS module, I'll create a
mem leak for the apps which does not use the client library as described
above.

Regards,

--

-- 
(Continue reading)

paul | 1 Aug 2002 16:55
Favicon

bk commit into 4.0 tree

Below is the list of changes that have just been committed into a
4.0 repository of paul. When paul does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet <at> 1.1139, 2002-08-01 09:55:26-05:00, paul <at> teton.kitebird.com
  manual.texi	fixups for mysqld_multi section

  Docs/manual.texi
    1.1070 02/08/01 09:54:56 paul <at> teton.kitebird.com +62 -46
    fixups for mysqld_multi section

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	paul
# Host:	teton.kitebird.com
# Root:	/home/paul/mysql-4.0

--- 1.1069/Docs/manual.texi	Wed Jul 31 17:41:49 2002
+++ 1.1070/Docs/manual.texi	Thu Aug  1 09:54:56 2002
 <at>  <at>  -20825,7 +20825,7  <at>  <at> 
  <at> menu
 * Server-Side Overview::        Overview of the Server-Side Scripts and Utilities
 * safe_mysqld::                  <at> code{safe_mysqld}, The Wrapper Around  <at> code{mysqld}
-* mysqld_multi::                 <at> code{mysqld_multi}, Program for Managing Multiple MySQL Servers
+* mysqld_multi::                 <at> code{mysqld_multi}, A Program for Managing Multiple MySQL Servers
 * myisampack::                   <at> code{myisampack}, The MySQL Compressed Read-only Table Generator
(Continue reading)

Tim Bunce | 1 Aug 2002 19:11
Picon
Favicon

Re: bk commit into 4.0 tree

On Thu, Aug 01, 2002 at 09:55:32AM -0500, paul <at> kitebird.com wrote:
> +using  <at> code{safe_mysqld} instead of  <at> code{mysqld} directly here is,
> +that  <at> code{safe_mysqld} ``guards'' every  <at> code{mysqld} process and will

Now that safe_mysqld has been renamed mysqld_safe in v4.0.0, is
there a policy for which the docs should refer to?

Will future v3.23.x releases ship with both to allow migration
(and for the docs to be updated to only refer to the new name)?

Tim.

---------------------------------------------------------------------
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 internals-thread4236 <at> lists.mysql.com
To unsubscribe, e-mail <internals-unsubscribe <at> lists.mysql.com>

paul | 1 Aug 2002 23:47
Favicon

bk commit into 4.0 tree

Below is the list of changes that have just been committed into a
4.0 repository of paul. When paul does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet <at> 1.1141, 2002-08-01 16:47:10-05:00, paul <at> teton.kitebird.com
  manual.texi	tweaks

  Docs/manual.texi
    1.1071 02/08/01 16:46:52 paul <at> teton.kitebird.com +15 -15
    tweaks

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	paul
# Host:	teton.kitebird.com
# Root:	/home/paul/mysql-4.0

--- 1.1070/Docs/manual.texi	Thu Aug  1 09:54:56 2002
+++ 1.1071/Docs/manual.texi	Thu Aug  1 16:46:52 2002
 <at>  <at>  -13663,7 +13663,7  <at>  <at> 
  <at> subsection Using  <at> code{AUTO_INCREMENT}

  <at> cindex AUTO_INCREMENT
-The  <at> code{AUTO_INCREMENT} attribute can be used to generate an unique
+The  <at> code{AUTO_INCREMENT} attribute can be used to generate a unique
 identity for new rows:
(Continue reading)

paul | 1 Aug 2002 23:58
Favicon

bk commit into 4.0 tree

Below is the list of changes that have just been committed into a
4.0 repository of paul. When paul does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet <at> 1.1142, 2002-08-01 16:57:59-05:00, paul <at> teton.kitebird.com
  manual.texi	tweaks

  Docs/manual.texi
    1.1072 02/08/01 16:57:45 paul <at> teton.kitebird.com +7 -5
    tweaks

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	paul
# Host:	teton.kitebird.com
# Root:	/home/paul/mysql-4.0

--- 1.1071/Docs/manual.texi	Thu Aug  1 16:46:52 2002
+++ 1.1072/Docs/manual.texi	Thu Aug  1 16:57:45 2002
 <at>  <at>  -5464,7 +5464,7  <at>  <at> 
  <at> subsubsection Preparing the Windows MySQL Environment

 Starting with MySQL 3.23.38, the Windows distribution includes
-both the normal and the  <at> strong{MySQL-Max} server binaries.
+both the normal and the MySQL-Max server binaries.
 Here is a list of the different MySQL servers you can use:
(Continue reading)

jani | 2 Aug 2002 02:24
Picon
Favicon

bk commit into 4.0 tree

Below is the list of changes that have just been committed into a
4.0 repository of jani. When jani does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.1143 02/08/02 03:24:02 jani <at> rhols221.adsl.netsonic.fi +1 -0
  Portability fix for QNX 6.2

  include/my_global.h
    1.25 02/08/02 03:23:57 jani <at> rhols221.adsl.netsonic.fi +2 -0
    Passed a bug in QNX 6.2 library that affected compiling.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jani
# Host:	rhols221.adsl.netsonic.fi
# Root:	/home/my/bk/mysql-4.0

--- 1.24/include/my_global.h	Sun Jun 30 23:04:09 2002
+++ 1.25/include/my_global.h	Fri Aug  2 03:23:57 2002
 <at>  <at>  -127,6 +127,8  <at>  <at> 
 #undef  HAVE_SYS_UN_H
 #undef  HAVE_FINITE
 #undef  HAVE_RINT
+#undef  LONGLONG_MIN            /* These get wrongly defined in QNX 6.2 */
+#undef  LONGLONG_MAX            /* standard system library 'limits.h' */
(Continue reading)

Tim Bunce | 2 Aug 2002 15:25
Picon
Favicon

Database server tuning: The Oracle Wait Interface

Monty, we spoke at the conference about the mechanisms Oracle
provides to do database performance tuning.

I said I'd send you some information...

http://www.quest-pipelines.com/newsletter-v3/0402_C.htm
http://www.quest.com/whitepapers/TuningOracleWithoutCacheHit.pdf

Details of the views that form the "Oracle Wait Interface":
http://download-west.oracle.com/otndoc/oracle9i/901_doc/server.901/a90190/apa.htm#264187

Tim.

---------------------------------------------------------------------
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 internals-thread4240 <at> lists.mysql.com
To unsubscribe, e-mail <internals-unsubscribe <at> lists.mysql.com>


Gmane