Bug #8472 Solaris 9 client cannot connect to server in threaded environment

Submitted: 12 Feb 2005 12:07 Modified: 7 May 2005 9:24
Reporter: Paul Kranenburg Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.2 alpha OS:Solaris (Solaris 9)
Assigned to: CPU Architecture:Any

[12 Feb 2005 12:07] Paul Kranenburg
Description:
When building the shared client library from source on Solaris 9 `UNDEF_THREADS_HACK' gets defined. In turn, this leads to the inclusion of
the system header file <errno.h> without defining _REENTRANT. As a result,
`errno' is declared as a global integer.

This is incorrect in a threaded environment and leads to incorrect behaviour of
the function my_connect(). This function examines the `errno value' corresponding
to the main thread instead of the per-thread  value and returns failure.

Most likely, lots of other functions are affected as well, if only by reporting
incorrect error messages on failure.

How to repeat:
Use the client code to connect to a mysql server from a thread-enabled web server
such as apache 2.0.x

Suggested fix:
I'm not sure what UNDEF_THREADS_HACK is all about.
But at least on Solaris always make sure _REENTRANT is defined.
[7 May 2005 9:24] Hartmut Holzgraefe
We provide two different library versions: libmysqlclient and libmysqlclient_r.
Only the later one is thread safe itself so this is the library you want to link
multi threaded application against.
You have to configure the source with --enable-thread-safe-client to build it.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.