[mod_python] threads and FreeBSD: LD_PRELOAD=/usr/lib/libc_r.so the same as --enable-threads?

Chad Whitacre chad at zetaweb.com
Fri Sep 1 17:17:27 EDT 2006


Perhaps I ought to include more detail. Below are my install notes thus 
far. Thanks.



Download from http://www.modpython.org/

    $ ./configure --with-apxs=/usr/local/apache2/bin/apxs
    $ make
    $ sudo make install

Unfortunately, doing the standard dance on FreeBSD gives you the 
following error when you try to LoadModule:

   Syntax error on line 36 of /usr/local/apache2/conf/httpd.conf:
   Cannot load /usr/local/apache2/modules/mod_python.so into server:
     /usr/local/apache2/modules/mod_python.so: Undefined symbol

"[T]hreads do not work well with Apache on FreeBSD",[1] so Apache does 
not build with them by default on FreeBSD. You can get mod_python to 
minimally work by compiling Apache with --enable-threads,[2] but using a 
threaded Apache on FreeBSD does indeed appear to be a bad idea:

     * "The general experience is that after not very long, Apache starts
       eating 100% of the CPU and not answering queries."[3]
     * "After doing a apache benchmark test with 'ab' I see a lot of
       stuck http gets in /server-status listing."[4]

Grisha's answer is to "cause Apache to start with threaded libs"[5] by 
adding this to /usr/local/apache2/bin/envvars:[6]

   export LD_PRELOAD=/usr/lib/libc_r.so

But is this the same as compiling Apache with --enable-threads? There be 
dragons, as noted above. Per ld.so(1),[7] LD_PRELOAD denotes "[a] list 
of shared libraries, separated by colons and/or white space, to be 
linked in before any other shared libraries." And here my knowledge 
ends: does linking in the library mean that Apache uses it (acquires 
threadedness), or just that mod_python does? Does this mean I can use 
threads from Python?

Here's the thread on this problem on the mod_python dev list:

     * Re: FreeBSD compile problem (was Getting ready for 3.2 beta 2)[8]


[3] http://archives.seul.org/or/dev/Sep-2003/msg00016.html

More information about the Mod_python mailing list