You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Timothy Martin <in...@me.com> on 2009/02/14 01:13:01 UTC

apache segfaults with dbd + php + mysql

I ran in to a problem where I couldn't seem to use apr and apr-util  
1.3.x because Apache httpd would segfault every time. I found bugs  
filed on gentoo, php, and discussion in some forums, but it wasn't  
clear to me that this info was getting where it needed to be... the  
apr developers, right?

It seemed that everyone who had the problem downgraded to 1.2 and left  
it at that. I just wanted to be a samaritan -- I'm not even a  
developer. I can add any debugging info if instructed how to obtain  
it... But here's what i found online:

Discussion:
	http://forums.gentoo.org/viewtopic-t-707991-highlight-apache.html

Bug filed on gentoo:
	https://bugs.gentoo.org/show_bug.cgi?id=240264

Bug filed on php5:
	http://bugs.php.net/bug.php?id=45995

If you guys already know about it (and have maybe even already fixed  
it) all the better!

.tim

Re: apache segfaults with dbd + php + mysql

Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Saturday 14 February 2009, Timothy Martin wrote:
> Strangely, in my functioning configuration (with apr and apr-util  
> downgraded to 1.2.x) appears to already be at odds with php as far
> as   the libmysqlclient_r.so is concerned.  (ldd output below)

Things can go wrong when both libs are loaded, but it can also work by 
accident. Comparing 1.2.x (everything in one lib) with 1.3.x (the 
mysql driver in a separate lib), the load order of the 
libmysqlclient*.so libs in apache is likely different. This could be 
the reason why it works with 1.2.x.

BTW, using both "DBDriver mysql" and php-mysql at the same time works 
fine under Debian with apr-util 1.3.2 and Debian has php-mysql 
linking to libmysqlclient_r.so.

Also, I would expect that people who compile apache(prefork) with the 
embedded apr-util also don't have problems because they get a 
non-threaded apr-util that links to libmysqlclient.so.

> I saw that one solution might be to symlink /usr/lib64/
> libmysqlclient.so.15.0.0 -> mysql/libmysqlclient_r.so.15.0.0 and  
> recompile php.

Maybe, but it also may create problems with other programs.

Cheers,
Stefan

Re: apache segfaults with dbd + php + mysql

Posted by Timothy Martin <in...@me.com>.
Strangely, in my functioning configuration (with apr and apr-util  
downgraded to 1.2.x) appears to already be at odds with php as far as  
the libmysqlclient_r.so is concerned.  (ldd output below)

I'll try getting them all to use the same one later tonight. But it's  
it's strange that they appear to be differing already and are running  
just fine.

I saw that one solution might be to symlink /usr/lib64/ 
libmysqlclient.so.15.0.0 -> mysql/libmysqlclient_r.so.15.0.0 and  
recompile php. Would that work? I don't compile directly from source  
-- i use gentoo portage (like bsd ports) and i'm not really fond of  
patching and install it myself because i often screw up other stuff.

.tim

ldd /usr/lib64/libapr-1.so.0.2.12
	linux-vdso.so.1 =>  (0x00007fff61ffe000)
	libuuid.so.1 => /lib/libuuid.so.1 (0x00007f8259b77000)
	librt.so.1 => /lib/librt.so.1 (0x00007f825996e000)
	libcrypt.so.1 => /lib/libcrypt.so.1 (0x00007f8259739000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007f825951e000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007f825931a000)
	libc.so.6 => /lib/libc.so.6 (0x00007f8258fda000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f8259fad000)

ldd /usr/lib64/libaprutil-1.so.0.0.0
	linux-vdso.so.1 =>  (0x00007fffea9fe000)
	libz.so.1 => /lib/libz.so.1 (0x00007fa7e243b000)
	libnsl.so.1 => /lib/libnsl.so.1 (0x00007fa7e2224000)
	libm.so.6 => /lib/libm.so.6 (0x00007fa7e1fa2000)
	libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0x00007fa7e1d53000)
	libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0x00007fa7e19ce000)
	libgdbm.so.3 => /usr/lib/libgdbm.so.3 (0x00007fa7e17c7000)
	libdb-4.5.so => /usr/lib/libdb-4.5.so (0x00007fa7e14a8000)
	libmysqlclient_r.so.15 => /usr/lib/libmysqlclient_r.so.15  
(0x00007fa7e1131000)
	libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007fa7e0f0c000)
	libapr-1.so.0 => /usr/lib/libapr-1.so.0 (0x00007fa7e0ce2000)
	libuuid.so.1 => /lib/libuuid.so.1 (0x00007fa7e0add000)
	librt.so.1 => /lib/librt.so.1 (0x00007fa7e08d3000)
	libcrypt.so.1 => /lib/libcrypt.so.1 (0x00007fa7e069f000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007fa7e0484000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007fa7e027f000)
	libc.so.6 => /lib/libc.so.6 (0x00007fa7dff40000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fa7e2875000)

ldd apache2
	linux-vdso.so.1 =>  (0x00007fff683fe000)
	libpcre.so.0 => /usr/lib/libpcre.so.0 (0x00007f9e5fe7a000)
	libbz2.so.1 => /lib/libbz2.so.1 (0x00007f9e5fc6a000)
	libaprutil-1.so.0 => /usr/lib/libaprutil-1.so.0 (0x00007f9e5fa4c000)
	libz.so.1 => /lib/libz.so.1 (0x00007f9e5f837000)
	libnsl.so.1 => /lib/libnsl.so.1 (0x00007f9e5f620000)
	libm.so.6 => /lib/libm.so.6 (0x00007f9e5f39f000)
	libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0x00007f9e5f150000)
	libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0x00007f9e5edcb000)
	libgdbm.so.3 => /usr/lib/libgdbm.so.3 (0x00007f9e5ebc5000)
	libdb-4.5.so => /usr/lib/libdb-4.5.so (0x00007f9e5e8a6000)
	libmysqlclient_r.so.15 => /usr/lib/libmysqlclient_r.so.15  
(0x00007f9e5e52f000)
	libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f9e5e30b000)
	libapr-1.so.0 => /usr/lib/libapr-1.so.0 (0x00007f9e5e0e1000)
	libuuid.so.1 => /lib/libuuid.so.1 (0x00007f9e5dedc000)
	librt.so.1 => /lib/librt.so.1 (0x00007f9e5dcd3000)
	libcrypt.so.1 => /lib/libcrypt.so.1 (0x00007f9e5da9f000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007f9e5d884000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007f9e5d680000)
	libc.so.6 => /lib/libc.so.6 (0x00007f9e5d341000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f9e600a8000)

ldd libphp5.so
	linux-vdso.so.1 =>  (0x00007fff7adfe000)
	libcrypt.so.1 => /lib/libcrypt.so.1 (0x00007fb572187000)
	libz.so.1 => /lib/libz.so.1 (0x00007fb571f71000)
	libhistory.so.5 => /lib/libhistory.so.5 (0x00007fb571d68000)
	libreadline.so.5 => /lib/libreadline.so.5 (0x00007fb571b27000)
	libncurses.so.5 => /lib/libncurses.so.5 (0x00007fb5718c9000)
	libpanel.so.5 => /usr/lib/libpanel.so.5 (0x00007fb5716c4000)
	libmcrypt.so.4 => /usr/lib/libmcrypt.so.4 (0x00007fb571494000)
	libltdl.so.3 => /usr/lib/libltdl.so.3 (0x00007fb57128c000)
	libpam.so.0 => /lib/libpam.so.0 (0x00007fb57107f000)
	libt1.so.5 => /usr/lib/libt1.so.5 (0x00007fb570e25000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007fb570b95000)
	libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00007fb57096f000)
	libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00007fb57074d000)
	libdb-4.5.so => /usr/lib/libdb-4.5.so (0x00007fb57042e000)
	libgdbm.so.3 => /usr/lib/libgdbm.so.3 (0x00007fb570227000)
	libbz2.so.1 => /lib/libbz2.so.1 (0x00007fb570017000)
	libpcre.so.0 => /usr/lib/libpcre.so.0 (0x00007fb56fde9000)
	libresolv.so.2 => /lib/libresolv.so.2 (0x00007fb56fbd4000)
	libm.so.6 => /lib/libm.so.6 (0x00007fb56f953000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007fb56f74f000)
	libnsl.so.1 => /lib/libnsl.so.1 (0x00007fb56f537000)
	libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0x00007fb56f2e8000)
	libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0x00007fb56ef63000)
	libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007fb56ed20000)
	libmysqlclient.so.15 => /usr/lib64/mysql/libmysqlclient.so.15  
(0x00007fb56e9ad000)
	libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007fb56e669000)
	libc.so.6 => /lib/libc.so.6 (0x00007fb56e329000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fb572cc4000)
	librt.so.1 => /lib/librt.so.1 (0x00007fb56e120000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007fb56df04000)

ldd /usr/bin/php
	linux-vdso.so.1 =>  (0x00007fff495fe000)
	libcrypt.so.1 => /lib/libcrypt.so.1 (0x00007fba411ab000)
	libz.so.1 => /lib/libz.so.1 (0x00007fba40f96000)
	libhistory.so.5 => /lib/libhistory.so.5 (0x00007fba40d8d000)
	libreadline.so.5 => /lib/libreadline.so.5 (0x00007fba40b4c000)
	libncurses.so.5 => /lib/libncurses.so.5 (0x00007fba408ee000)
	libpanel.so.5 => /usr/lib/libpanel.so.5 (0x00007fba406ea000)
	libmcrypt.so.4 => /usr/lib/libmcrypt.so.4 (0x00007fba404ba000)
	libltdl.so.3 => /usr/lib/libltdl.so.3 (0x00007fba402b2000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007fba400ae000)
	libpam.so.0 => /lib/libpam.so.0 (0x00007fba3fea2000)
	libt1.so.5 => /usr/lib/libt1.so.5 (0x00007fba3fc48000)
	libm.so.6 => /lib/libm.so.6 (0x00007fba3f9c7000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007fba3f737000)
	libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00007fba3f512000)
	libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00007fba3f2f0000)
	libdb-4.5.so => /usr/lib/libdb-4.5.so (0x00007fba3efd1000)
	libgdbm.so.3 => /usr/lib/libgdbm.so.3 (0x00007fba3edcb000)
	libpcre.so.0 => /usr/lib/libpcre.so.0 (0x00007fba3eb9d000)
	libbz2.so.1 => /lib/libbz2.so.1 (0x00007fba3e98d000)
	libresolv.so.2 => /lib/libresolv.so.2 (0x00007fba3e779000)
	libnsl.so.1 => /lib/libnsl.so.1 (0x00007fba3e562000)
	libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0x00007fba3e313000)
	libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0x00007fba3df8e000)
	libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007fba3dd4c000)
	librt.so.1 => /lib/librt.so.1 (0x00007fba3db43000)
	libmysqlclient.so.15 => /usr/lib64/mysql/libmysqlclient.so.15  
(0x00007fba3d7d0000)
	libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007fba3d48c000)
	libc.so.6 => /lib/libc.so.6 (0x00007fba3d14d000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fba413df000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007fba3cf32000)



On Feb 13, 2009, at 4:44pm, Stefan Fritsch wrote:

> Hi,
>
> On Saturday 14 February 2009, Timothy Martin wrote:
>> I ran in to a problem where I couldn't seem to use apr and apr-util
>> 1.3.x because Apache httpd would segfault every time. I found bugs
>> filed on gentoo, php, and discussion in some forums, but it wasn't
>> clear to me that this info was getting where it needed to be... the
>> apr developers, right?
>>
>> It seemed that everyone who had the problem downgraded to 1.2 and
>> left it at that.
>
> this could be due to php-mysql linking to libmysqlclient.so and
> apr-util-mysql linking to libmysqlclient_r.so (you can verify that
> with ldd). Since both libraries use the same symbols and symbol
> versions, all kinds of things can go wrong when both are loaded into
> the same process.
>
> You can try compiling php with libmysqlclient_r.so, e.g. by using this
> patch
>
> http://svn.debian.org/wsvn/pkg-php/php5/trunk/debian/patches/force_libmysqlclient_r.patch?op=file&rev=0&sc=0
>
> and recreating configure. There is some discussion about this issue at
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=450535
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=469081
> http://bugs.mysql.com/bug.php?id=32196
>
>
> Cheers,
> Stefan


Re: apache segfaults with dbd + php + mysql

Posted by Stefan Fritsch <sf...@sfritsch.de>.
Hi,

On Saturday 14 February 2009, Timothy Martin wrote:
> I ran in to a problem where I couldn't seem to use apr and apr-util
> 1.3.x because Apache httpd would segfault every time. I found bugs
> filed on gentoo, php, and discussion in some forums, but it wasn't
> clear to me that this info was getting where it needed to be... the
> apr developers, right?
>
> It seemed that everyone who had the problem downgraded to 1.2 and
> left it at that.

this could be due to php-mysql linking to libmysqlclient.so and 
apr-util-mysql linking to libmysqlclient_r.so (you can verify that 
with ldd). Since both libraries use the same symbols and symbol 
versions, all kinds of things can go wrong when both are loaded into 
the same process.

You can try compiling php with libmysqlclient_r.so, e.g. by using this 
patch

http://svn.debian.org/wsvn/pkg-php/php5/trunk/debian/patches/force_libmysqlclient_r.patch?op=file&rev=0&sc=0

and recreating configure. There is some discussion about this issue at

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=450535
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=469081
http://bugs.mysql.com/bug.php?id=32196


Cheers,
Stefan