Bug #8473 Solaris 9 client cannot connect to server in threaded environment
Submitted: 12 Feb 2005 12:07 Modified: 14 Feb 2005 10:35
Reporter: Paul Kranenburg Email Updates:
Status: Duplicate 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.
[14 Feb 2005 10:35] Victoria Reznichenko
Duplicate for #8472