Subject: Strange PHP/LDAP problem
To: None <netbsd-users@netbsd.org>
From: Michael Kukat <michael@unixiron.org>
List: netbsd-users
Date: 02/11/2002 14:55:13
Hello,
since several days, i have a very strange problem after updating my OpenLDAP
and PHP packages on 2 machines. Before this, i had running OpenLDAP 1.somewhat
and PHP 4.0.4. Not, it is:
openldap-2.0.22 and php-4.1.1
My PHP-scripts, which ran perfectly prior this update, now just throw core
dumps. I debugged a bit:
[michael@calchas michael]$ uname -a; echo '<?php ldap_connect("ldap://ldap.unixiron.org"); ?>' | php
NetBSD calchas.unixiron.org 1.5.2 NetBSD 1.5.2 (calchas) #2: Wed Jan 16 19:38:29 CET 2002 root@:/usr/src/sys/arch/i386/compile/calchas i386
Content-type: text/html
Segmentation fault (core dumped)
And on another platform (pmax)
bash-2.05$ uname -a ;echo '<?php ldap_connect("ldap://ldap.unixiron.org"); ?>' | php
NetBSD www.dmz.unixiron.org 1.5.2 NetBSD 1.5.2 (GENERIC) #0: Sun Aug 19 23:26:10 EST 2001 root@medusa.thistledown.com.au:/usr/obj/NetBSD/src15/sys/arch/pmax/compile/GENERIC pmax
Content-type: text/html
And no segmentation failt. So, my tracing on i386 brought out the following:
The script works fine, all LDAP functions work, everything is ok, but if the
script exits, the segmentation fault occurs. And it exactly occurs, if there
is a call to ldap_connect. This call is enough to crash php, but not
immediately, it crashes, when the script exits.
I continued debugging:
if in ldap.c from PHP, ldap_init is called, no matter if it returns success
or not, PHP crashes when finishing. If i replace the ldap_init with a
failed return, it works fine. ldap_open also doesn't work, as this calls
ldap_init, i had a look at the openldap-sources here.
If i write a small C program calling ldap_init, this doesn't crash, so the
problem is PHP-related.
So, i got the ktruss... here is the result:
pmax platform:
16563 php __sigaltstack14(0, 0x7fffdfbc) = 0
16563 php setitimer(0x2, 0x7fffdfb0, 0) = 0
16563 php munmap(0x201ff000, 0x50000) Err#22 EINVAL
16563 php munmap(0x2024f000, 0x72000) Err#22 EINVAL
16563 php munmap(0x202c1000, 0x4c000) Err#22 EINVAL
16563 php munmap(0x2030d000, 0x179000) Err#22 EINVAL
16563 php munmap(0x20486000, 0x144000) Err#22 EINVAL
16563 php munmap(0x205ca000, 0x4f000) Err#22 EINVAL
16563 php munmap(0x20619000, 0x54000) Err#22 EINVAL
16563 php exit(0)
i386 platform:
28686 php __sigprocmask14(0, 0, 0x81060b0) = 0
28686 php setitimer(0x2, 0xbfbfd3e0, 0) = 0
28686 php munmap(0x481bd000, 0xb000) = 0
28686 php munmap(0x481c8000, 0x22000) = 0
28686 php munmap(0x481ea000, 0x9000) = 0
28686 php munmap(0x481f3000, 0x2a000) = 0
28686 php munmap(0x4821d000, 0xb3000) = 0
28686 php munmap(0x482d0000, 0xb000) = 0
28686 php munmap(0x482db000, 0x11000) = 0
SIGSEGV SIG_DFL
28686 php "php.core"
EINVAL is also strange, but the problem seems to occur in freeing resources
so, as a last point, i look at the php.core file
(gdb) bt
#0 0x481ddfc8 in ?? ()
#1 0x8058cb7 in ___start ()
(I don't know much about finding out more with gdbm but i interpret this as
the segfault occurs in the startup module...)
Did anybody see the same problems? I also checked in some changes from the PHP-
cvs manually, but it looks for me as a problem either in OpenLDAP or even in
the startup code (crt0) or so. Any ideas/hints?
...Michael
--
http://www.bsdfans.org/ Home network powered by: NetBSD OpenBSD FreeBSD IRIX
Solaris AIX HP-UX Tru64 MUNIX Ultrix VMS SINIX Dolphin_Unix OpenStep MacOS A/UX