You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Mark Constable <ma...@renta.net> on 2006/10/28 09:10:00 UTC

apr_dbd_mysql for apache2.2

I'm trying to build an apr-util with apr_dbd_mysql.c so I
downloaded...

 http://apache.webthing.com/svn/apache/apr/apr_dbd_mysql.c

into the apr-util-1.2.7/dbd build directory and did a buildconf
as the apr-util INSTALL.MySQL says. I added --with-mysql to the
configure invocation and all seems well...

 checking mysql.h usability... no
 checking mysql.h presence... no
 checking for mysql.h... no
 checking mysql/mysql.h usability... yes
 checking mysql/mysql.h presence... yes
 checking for mysql/mysql.h... yes
 checking for mysql_init in -lmysqlclient_r... yes
   adding "-Iyes/include/myql" to APRUTIL_INCLUDES
   adding "-lmysqlclient_r" to APRUTIL_EXPORT_LIBS
   adding "-lmysqlclient_r" to APRUTIL_LIBS

however, after installing the resulting package I get...

# nm -D /usr/lib/libaprutil-1.so.0 | grep mysql
         U apr_dbd_mysql_driver

and apache obviously complains about an...

 undefined symbol: apr_dbd_mysql_driver

and in the dbd/ folder there is no apr_dbd_mysql.lo or 
apr_dbd_mysql.o as I would expect. No doubt it's just a build
issue but would anyone have a suggestion what to do next ?

--markc

Re: apr_dbd_mysql for apache2.2

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Is anyone actually using MySQL(5) for authentication with apache2.2 ?

Yes, me.  /me thinks it your OS :) 
I just compiled this on my desktop to be sure, but this combo works as 
of now:
  apr - svn trunk
  apr-util svn trunk
  httpd trunk
  mysql 5.0.24
  FreeBSD 7.0-current

Attached are my config.nice(in this order: apr,apr-util,httpd) files and 
relevant httpd.conf stuff.


Re: apr_dbd_mysql for apache2.2

Posted by Mark Constable <ma...@renta.net>.
On Sunday 29 October 2006 22:30, Joachim Zobel wrote:
> Am Sonntag, den 29.10.2006, 14:39 +1000 schrieb Mark Constable:
> > *** glibc detected *** /usr/sbin/httpd: double free or corruption (!prev): 0x08278360 ***
> 
> This is often mention as "the dreaded ...". Glibc has from a certain
> version on treatet double free as a fatal error. I remember lots of apps
> on my laptop blew up when debian testing (etch) hit this.
> 
> According to
> 
> http://mail-archives.apache.org/mod_mbox/httpd-bugs/200605.mbox/%
> 3Cbug-39513-7868@http.issues.apache.org/bugzilla/%3E
> 
> setting the env' var' MALLOC_CHECK_=1 or 0 should work around.

Thanks for that hint but it didn't help in this case. When using this
directive apache will start up, and only the process handling a request
to the /home/w/lan/aria/www URL will segfault when accessed...

<Directory /home/w/lan/aria/www>
 AuthType Basic
 AuthName "Aria"
 AuthBasicProvider dbd
 Require valid-user
# AuthDBDUserPWQuery "select pw from passwd where uid = %s"
</Directory>

but when the AuthDBDUserPWQuery line is uncommented then apache dies
on startup much earlier than I would expect, just after opening the
passwd/group files...

open("/etc/group", O_RDONLY)            = 5
fcntl64(5, F_GETFD)                     = 0
fcntl64(5, F_SETFD, FD_CLOEXEC)         = 0
fstat64(5, {st_mode=S_IFREG|0644, st_size=552, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7214000
read(5, "root:x:0:root\ndaemon:x:1:root,bi"..., 4096) = 552
close(5)                                = 0
munmap(0xb7214000, 4096)                = 0

... segfaults here when AuthDBDUserPWQuery is uncommented.

uname({sys="Linux", node="aria", ...})  = 0
socket(PF_NETLINK, SOCK_RAW, 0)         = 5
bind(5, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
getsockname(5, {sa_family=AF_NETLINK, pid=12296, groups=00000000}, [12]) = 0
time(NULL)                              = 1162170947
... etc


And FWIW I tried libapache-mod-auth-mysql-4.3.9 (a Debian source
package) but it looks like it would also take quite a bit of work
to get working with apache2.2, if ever...

# make
/usr/sbin/apxs  -o apache2_mod_auth_mysql.la -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient -DAPACHE2 -c mod_auth_mysql.c
/usr/build-1/libtool --silent --mode=compile gcc -prefer-pic -march=i686 -O2 -pipe  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/apache  -I/usr/include/apr-1   -I/usr/include/apr-1 -I/usr/include -I/usr/include/mysql -I/usr/include/mysql -DAPACHE2  -c -o mod_auth_mysql.lo mod_auth_mysql.c && touch mod_auth_mysql.slo
mod_auth_mysql.c:686: error: expected expression before 'mysql_auth_config_rec'
mod_auth_mysql.c:686: error: initializer element is not constant
mod_auth_mysql.c:686: error: (near initialization for 'mysql_auth_cmds[8].cmd_data')
... etc


Is anyone actually using MySQL(5) for authentication with apache2.2 ?

--markc

Re: apr_dbd_mysql for apache2.2

Posted by Joachim Zobel <jz...@heute-morgen.de>.
Am Sonntag, den 29.10.2006, 14:39 +1000 schrieb Mark Constable:
> *** glibc detected *** /usr/sbin/httpd: double free or corruption (!prev): 0x08278360 ***

This is often mention as "the dreaded ...". Glibc has from a certain
version on treatet double free as a fatal error. I remember lots of apps
on my laptop blew up when debian testing (etch) hit this.

According to

http://mail-archives.apache.org/mod_mbox/httpd-bugs/200605.mbox/%
3Cbug-39513-7868@http.issues.apache.org/bugzilla/%3E

setting the env' var' MALLOC_CHECK_=1 or 0 should work around.

Sincerely,
Joachim



Re: apr_dbd_mysql for apache2.2

Posted by Mark Constable <ma...@renta.net>.
On Sunday 29 October 2006 04:59, Philip M. Gollucci wrote:
> Yes, I've had good look with svn branches/1.2.x
> 
> ./configure --prefix=$prefix_apr
> 
> ./configure \
>      --prefix=$prefix_apu \
>      --with-apr=$prefix_apr \
>      --with-mysql=$INST/mysql/$mysql_ver

Great, thanks. I managed to get apr & apr-util to compile using
svn from http://apr.apache.org/anonsvn.html however when using only
this part in httpd.conf it's okay and I can see that MySQL is accessed...

 DBDriver mysql
 DBDParams "host=localhost dbname=admin user=xxxx pass=xxxx"
 DBDMin  1
 DBDKeep 2
 DBDMax  10
 DBDExptime 60

but when I add this section below then apache segfaults on startup...

 <Directory /home/w/lan/aria/www>
 AuthType Basic
 AuthName "Aria"
 AuthBasicProvider dbd
 Require valid-user
 AuthDBDUserPWQuery "select pw from passwd where uid = %s"
 </Directory>

I also recompiled apache 2.2.3 after installing the updated apr &
apr-util which I presume would use the new apr but it still segfaults.

 # apachectl start
 + case $ARGV in
 + /usr/sbin/httpd -k start
 /usr/sbin/apachectl: line 78:  2177 Segmentation fault      $HTTPD -k $ARGV
 + ERROR=139
 + exit 139

And from var/log/httpd/error_log...

*** glibc detected *** /usr/sbin/httpd: double free or corruption (!prev): 0x08278360 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7d09e00]
/lib/libc.so.6(__libc_free+0x89)[0xb7d0b469]
/usr/lib/libapr-1.so.0(apr_allocator_destroy+0x2d)[0xb7e3b92d]
/usr/lib/libapr-1.so.0(apr_pool_destroy+0x195)[0xb7e3c045]
/usr/sbin/httpd[0x8085915]
/usr/sbin/httpd[0x808593d]
[0xb7fbb420]
/usr/sbin/httpd(unixd_accept+0x2c)[0x808743c]
/usr/sbin/httpd[0x8085c49]
/usr/sbin/httpd[0x808600d]
/usr/sbin/httpd[0x80860ca]
/usr/sbin/httpd(ap_mpm_run+0xc37)[0x8086d17]
/usr/sbin/httpd(main+0x828)[0x8061e98]
/lib/libc.so.6(__libc_start_main+0xd8)[0xb7cbb7c8]
/usr/sbin/httpd(apr_bucket_mmap_make+0x61)[0x80610d1]
... (much more)

Using gcc 4.4.1 and glibc 2.5 on an Archlinux system.

Any further suggestions ?

Would my time be better spent messing around with mod_auth_mysql perhaps ?

--markc

Re: apr_dbd_mysql for apache2.2

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Yes, I've had good look with svn branches/1.2.x

./configure --prefix=$prefix_apr

./configure \
     --prefix=$prefix_apu \
     --with-apr=$prefix_apr \
     --with-mysql=$INST/mysql/$mysql_ver



-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

When I call your name, Girl, it starts to flame
Burning in my heart, Tearing it all apart..
No matter how I try My love I cannot hide....

Re: apr_dbd_mysql for apache2.2

Posted by Mark Constable <ma...@renta.net>.
On Saturday 28 October 2006 18:47, Philip M. Gollucci wrote:
> > and in the dbd/ folder there is no apr_dbd_mysql.lo or 
> > apr_dbd_mysql.o as I would expect. No doubt it's just a build
> > issue but would anyone have a suggestion what to do next ?

> Yes, use apr 1.2.8-dev .... The mysql detection was fixed to use mysql_config
> instead of checking 2 hard coded places.

The nearest thing I could find was an apr snapshot which I presume
is 1.2.8-dev, for instance at...

 http://svn.apache.org/snapshots/apr/apr_20061028041545.tar.gz

which seemed to compile and install okay. I then rebuilt the 1.2.7
apr-util using buildconf --with-apr=/path/to/apr_20061028041545

... etc
/bin/sh /usr/build-1/libtool --silent --mode=compile gcc -pthread  -march=i686 -O2 -pipe -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE   -I/var/abs/local/apr-util/src/apr-util-1.2.7/include -I/var/abs/local/apr-util/src/apr-util-1.2.7/include/private  -I/usr/include/apr-1  -I/usr/include -Iyes/include/myql  -o dbd/apr_dbd_mysql.lo -c dbd/apr_dbd_mysql.c && touch dbd/apr_dbd_mysql.lo
dbd/apr_dbd_mysql.c:64: error: expected specifier-qualifier-list before 'MYSQL_STMT'
dbd/apr_dbd_mysql.c:76: error: expected specifier-qualifier-list before 'MYSQL'
dbd/apr_dbd_mysql.c:83: error: expected specifier-qualifier-list before 'MYSQL_RES'
dbd/apr_dbd_mysql.c:88: error: expected specifier-qualifier-list before 'MYSQL_ROW'
dbd/apr_dbd_mysql.c: In function 'dbd_mysql_select':
dbd/apr_dbd_mysql.c:104: error: 'apr_dbd_t' has no member named 'trans'
... etc

Hmm... -Iyes/include/myql ???

Is there a downloadable apr-util-1.2.8-dev package somewhere ?

or

Should I checkout out svn to get the latest apr and apr-util ?

Any hints appreciated.

--markc

Re: apr_dbd_mysql for apache2.2

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
this one time in band camp Mark Constable said on 10/28/06 00:10:
> I'm trying to build an apr-util with apr_dbd_mysql.c so I
> downloaded...
> 
>  http://apache.webthing.com/svn/apache/apr/apr_dbd_mysql.c
> 
> into the apr-util-1.2.7/dbd build directory and did a buildconf
> as the apr-util INSTALL.MySQL says. I added --with-mysql to the
> configure invocation and all seems well...
> 
>  checking mysql.h usability... no
>  checking mysql.h presence... no
>  checking for mysql.h... no
>  checking mysql/mysql.h usability... yes
>  checking mysql/mysql.h presence... yes
>  checking for mysql/mysql.h... yes
>  checking for mysql_init in -lmysqlclient_r... yes
>    adding "-Iyes/include/myql" to APRUTIL_INCLUDES
>    adding "-lmysqlclient_r" to APRUTIL_EXPORT_LIBS
>    adding "-lmysqlclient_r" to APRUTIL_LIBS
> 
> however, after installing the resulting package I get...
> 
> # nm -D /usr/lib/libaprutil-1.so.0 | grep mysql
>          U apr_dbd_mysql_driver
> 
> and apache obviously complains about an...
> 
>  undefined symbol: apr_dbd_mysql_driver
> 
> and in the dbd/ folder there is no apr_dbd_mysql.lo or 
> apr_dbd_mysql.o as I would expect. No doubt it's just a build
> issue but would anyone have a suggestion what to do next ?
Yes, use apr 1.2.8-dev .... The mysql detection was fixed to use mysql_config
instead of checking 2 hard coded places.

-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

When I call your name, Girl, it starts to flame
Burning in my heart, Tearing it all apart..
No matter how I try My love I cannot hide....