Bug #3037 Segfaults on startup, when using nss_ldap
Submitted: 2 Mar 2004 4:31 Modified: 24 Nov 2004 17:22
Reporter: Anton K Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.x OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[2 Mar 2004 4:31] Anton K
Description:
When nss_ldap enabled in /etc/nsswitch.conf in group database, mysqld crash at startup at initgroups() in sql/mysqld.cc while trying to get all groups of wich mysql user is a member from LDAP.

How to repeat:
compile nss_ldap with >>>4.2<<< Berkley DB.
add 'ldap' into /etc/nsswitch.conf to 'group' database
start mysqld server

Suggested fix:
use setgroups(0, 0) instead of initgroups(...) in sql/mysqld.cc
or
update bdb in mysql distribution :)
[2 Mar 2004 22:43] Paul Vlaar
I have reproduced this on RH AS 3.0, statically compiling MySQL 4.0.18, and
using LDAP for NSS lookups:

# /opt/mysql/libexec/mysqld --user=mysql
mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=8388600
read_buffer_size=131072
max_used_connections=0
max_connections=100
threads_connected=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 225791 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x83e3678
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0xbfff54e8, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x8092428
0x827a688
(nil)
0xb7ad1456
0xb7ad0f94
0xb7b12930
0xb7b12c40
0xb7b0985b
0xb7af53a1
0xb7afe35c
0xb7af1138
0xb7af1371
0xb7ae808e
0xb7aead7d
0x82a68f7
0x80919c2
0x8091b7c
0x80932db
0x82839c0
0x8048121
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://www.mysql.com/doc/en/Using_stack_trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do 
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at (nil)  is invalid pointer
thd->thread_id=138296552
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.

When I remove the "group: files ldap" line in favour of "group: files"
in /etc/nsswitch.conf, it works fine. We are preparing to move all our
machines to use LDAP authentication and NSS lookups, so this is pretty
critical to us.
[6 Mar 2004 7:06] MySQL Verification Team
This is a known bug in latest series of RH glibc ...

We have already fixed it on several IA-64 and Opteron boxes.

We are working on the patch for configure to fix it.

A manual fix is to #undef HAVE_INITGROPUS and re-build MySQL.

We have also filed a corresponding bug report in RH Bugzilla.

It is one of the latest reports.
[24 Nov 2004 17:22] Lenz Grimmer
This bug was marked as a duplicate of bug#4872