still mired

5 views
Skip to first unread message

Chad Whitacre

unread,
Jul 6, 2007, 11:55:15 PM7/6/07
to mod...@googlegroups.com
All,

So I've gotten mod_wsgi to compile cleanly, and it loads and
works fine under httpd -X (I can serve Hello World). However,
when I use apachectl, all processes simply die silently after
returning from wsgi_hook_init for the first time (i.e., after the
call to apr_pool_userdata_set). This is the case whether I use
the prefork or worker MPM.

Now I've built httpd w/o --enable-threads, and I'm getting this
error:

$ sudo httpd -X
Syntax error on line 37 of /usr/local/apache2/conf/httpd.conf:
Cannot load /usr/local/apache2/modules/mod_wsgi.so into server:
/usr/local/apache2/modules/mod_wsgi.so: Undefined symbol
"pthread_attr_init"

Too much for my head now. I'll have to attack this again later.


chad

Graham Dumpleton

unread,
Jul 7, 2007, 7:06:46 AM7/7/07
to mod...@googlegroups.com

The pthread library functions are in -lc_r on some BSD boxes. Thus
need to ensure that Apache links with that when being compiled, or use
LD_PRELOAD environment variable at run time to get Apache to link the
reentrant C library first.

This can usually be done in envvars file in Apache bin directory.

LD_PRELOAD=/usr/lib/libc_r.so
export LD_PRELOAD

Graham

Chad Whitacre

unread,
Jul 9, 2007, 6:49:45 AM7/9/07
to modwsgi
> > Now I've built httpd w/o --enable-threads, and I'm getting this
> > error:
>
> > $ sudo httpd -X
> > Syntax error on line 37 of /usr/local/apache2/conf/httpd.conf:
> > Cannot load /usr/local/apache2/modules/mod_wsgi.so into server:
> > /usr/local/apache2/modules/mod_wsgi.so: Undefined symbol
> > "pthread_attr_init"
>
> > Too much for my head now. I'll have to attack this again later.
>
> The pthread library functions are in -lc_r on some BSD boxes. Thus
> need to ensure that Apache links with that when being compiled, or use
> LD_PRELOAD environment variable at run time to get Apache to link the
> reentrant C library first.
>
> This can usually be done in envvars file in Apache bin directory.
>
> LD_PRELOAD=/usr/lib/libc_r.so
> export LD_PRELOAD

Deja vu:

http://www.modpython.org/pipermail/mod_python/2006-September/021986.html

:^)

Unfortunately I already have that line in envvars (from that previous
go-round with mod_python) and it's still not working. I'll try linking
it directly. Also, it occurs to me that I should look into Apache 2.2
+ FreeBSD wrt threading.


chad

Graham Dumpleton

unread,
Jul 9, 2007, 7:13:08 AM7/9/07
to mod...@googlegroups.com

What version of FreeBSD was it?

A few comments I have found:
http://mail-archives.apache.org/mod_mbox/httpd-dev/200311.mbox/%3C2147483647.1068993287@localhost%3E
http://ivoras.sharanet.org/freebsd/gotchas.html
http://bugs.caucho.com/view.php?id=485

The last one suggests that maybe should preload /usr/lib/libpthread.so instead.

What other modules are you using with Apache?

What does the following yield?

nm /usr/lib/libc_r.so | grep pthread_attr_init

nm mod_wsgi.so | grep pthread_attr_init

How big is mod_wsgi.so, greater than 1MB indicating it has Python
library statically linked?

Graham

Graham Dumpleton

unread,
Jul 9, 2007, 7:18:29 AM7/9/07
to mod...@googlegroups.com
One of those pages I reference also mentioned so libmap.conf file
which can be used to control which thread library is used even if that
wasn't the one which something was compiled with.

http://nixdoc.net/man-pages/FreeBSD/libmap.conf.5.html

That may be part of the answer.

Graham Dumpleton

unread,
Jul 9, 2007, 7:46:06 AM7/9/07
to mod...@googlegroups.com
May also be useful to do:

ldd python

ldd httpd

to work out what dependencies these may have on the now multiple
thread libraries FreeBSD seems to provide. This may be of use in
working out what may be required in libmap.conf file.

Graham

Chad Whitacre

unread,
Jul 9, 2007, 4:05:41 PM7/9/07
to modwsgi

Ouch! When I take the libc_r out of envvars, it works. :^)

Here's my write-up so far:

http://blag.whit537.org/2007/07/freebsd-threads-apache-and-modwsgi.html

Thanks for all the pointers, Graham!

chad

Graham Dumpleton

unread,
Jul 9, 2007, 10:33:16 PM7/9/07
to mod...@googlegroups.com

Interesting. I have updated my documentation on the issue to reflect
you latest finding.

http://code.google.com/p/modwsgi/wiki/InstallationIssues

Thanks for telling me the outcome.

Graham

Reply all
Reply to author
Forward
0 new messages