[mod_python] mod_python import failure on FreeBSD AMD64

Graham Dumpleton graham.dumpleton at gmail.com
Tue May 4 23:01:23 EDT 2010


On 5 May 2010 12:53, Surly The Clown <surly_the_clown at hotmail.com> wrote:
>> Date: Wed, 5 May 2010 09:30:10 +1000
>> Subject: Re: [mod_python] mod_python import failure on FreeBSD AMD64
>> From: graham.dumpleton at gmail.com
>> To: surly_the_clown at hotmail.com
>> CC: mod_python at modpython.org
>>
>> On 5 May 2010 09:12, Surly The Clown <surly_the_clown at hotmail.com> wrote:
>> > Hello all,
>> >
>> >
>> > I have two FreeBSD machines, both running the latest FreeBSD-8.0
>> > release,
>> > apache-2.2.14_6, and mod_python-3.3.1_2. On one of the machines, the
>> > i386
>> > one, there are no problems. Everything works fine. On the other one, an
>> > AMD64 machine, any attempt to access a page handled by mod_python
>> > results in
>> > a 500 Internal Server Error response and the following error log:
>> >
>> >
>> > [Tue May 04 14:41:34 2010] [notice] mod_python: Creating 8 session
>> > mutexes
>> > based on 256 max processes and 0 max threads.
>> > [Tue May 04 14:41:34 2010] [notice] mod_python: using mutex_directory
>> > /tmp
>> > [Tue May 04 14:41:34 2010] [notice] Apache/2.2.14 (FreeBSD)
>> > mod_python/3.3.1
>> > Python/2.6.4 configured -- resuming normal operations
>> > sem_init: No space left on device
>>
>> The first problem is that you don't have enough SYSV semaphores
>> configured for your system.
>>
>> You can try setting:
>>
>> PythonOption mod_python.mutex_locks 4
>>
>> to reduce number used, but you still may not have enough.
>>
>> Try fixing that first using that option, or by increasing number of
>> semaphores in kernel configuration.
>>
>> Graham
>
> Thank you very much for responding. The lack of activity on this mailing
> list had me thinking no one used it anymore.

It isn't actively developed any more and if all you want to do is host
a web application, and not hook into Apache request phases, you are
better off using WSGI capable Python web frameworks and hosting using
mod_wsgi or fastcgi/flup.

> I tried setting PythonOption mod_python.mutex_locks 4, and the problem
> persisted. I then tried increasing the number of available semaphores in the
> kernel from the default 10 (!) to 256, verified that that setting had
> changed, and then tried again. The problem still persists. Furthermore, four
> files that appear to be the mutexes exist in /tmp,

The sem_init() call is I believe a kernel thing, not a filesystem type of lock.

Such kernel setting changes usually only take affect after a system
reboot. Did you do that?

> named mpmtx15570 to
> mpmtx15573. Perhaps mod_python isn't using kernel semaphores? Its
> documentation says that it doesn't always. And /tmp isn't out of space (no
> partition is).

What is used depends on what Apache/APR sets up as default type of
semaphore. It prefers certain types and what is available depends on
the operating system.

> Any more ideas?

Don't use mod_python if you don't have to.

What are you wanting to host using it?

Graham

> Error log:
>
> [Tue May 04 19:42:14 2010] [notice] mod_python: Creating 4 session mutexes
> based on 256 max processes and 0 max threads.
> [Tue May 04 19:42:14 2010] [notice] mod_python: using mutex_directory /tmp
> [Tue May 04 19:42:14 2010] [notice] Apache/2.2.14 (FreeBSD) mod_python/3.3.1
> Python/2.6.4 configured -- resuming normal operations
> sem_init: No space left on device
> [Tue May 04 19:42:15 2010] [error] make_obcallback: could not import
> mod_python.apache.\n
> Traceback (most recent call last):
> File "/usr/local/lib/python2.6/site-packages/mod_python/apache.py", line 29,
> in <module>
> import cgi
> File "/usr/local/lib/python2.6/cgi.py", line 40, in <module>
> import urllib
> File "/usr/local/lib/python2.6/urllib.py", line 26, in <module>
> import socket
> File "/usr/local/lib/python2.6/socket.py", line 64, in <module>
> from _ssl import SSLError as sslerror
> ImportError: cannot import name SSLError
> [Tue May 04 19:42:15 2010] [error] make_obcallback: Python path being used
> "['/usr/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
> '/usr/local/lib/python2.6/site-packages/nose-0.11.1-py2.6.egg',
> '/usr/local/lib/python26.zip', '/usr/local/lib/python2.6',
> '/usr/local/lib/python2.6/plat-freebsd8', '/usr/local/lib/python2.6/lib-tk',
> '/usr/local/lib/python2.6/lib-old', '/usr/local/lib/python2.6/lib-dynload',
> '/usr/local/lib/python2.6/site-packages',
> '/usr/local/lib/python2.6/site-packages/Numeric',
> '/usr/local/lib/python2.6/site-packages/gtk-2.0']".
> [Tue May 04 19:42:15 2010] [error] get_interpreter: no interpreter callback
> found.
> [Tue May 04 19:42:15 2010] [error] [client 192.168.123.106] python_handler:
> Can't get/create interpreter.
> [Tue May 04 19:42:15 2010] [error] [client 192.168.123.106] File does not
> exist: /usr/home/chrisa/test/favicon.ico, referer:
> http://192.168.123.136:8080/fetch.py
>
> httpd.conf:
>
> ServerRoot "/usr/local"
>
> Listen 8080
> LoadModule deflate_module libexec/apache22/mod_deflate.so
> LoadModule log_config_module libexec/apache22/mod_log_config.so
> LoadModule mime_magic_module libexec/apache22/mod_mime_magic.so
> LoadModule unique_id_module libexec/apache22/mod_unique_id.so
> LoadModule mime_module libexec/apache22/mod_mime.so
> LoadModule dir_module libexec/apache22/mod_dir.so
> LoadModule authz_host_module libexec/apache22/mod_authz_host.so
> LoadModule python_module libexec/apache22/mod_python.so
> <IfModule !mpm_netware_module>
> <IfModule !mpm_winnt_module>
> User www
> Group www
> </IfModule>
> </IfModule>
> ServerAdmin you at example.com
> ServerName 192.168.123.136:8080
> DocumentRoot "/usr/home/chrisa/test"
> PythonOption mod_python.mutex_locks 4
> <Directory />
> AllowOverride None
> Options None
> Order deny,allow
> Deny from all
> </Directory>
> <Directory "/usr/home/chrisa/test">
> Options None
> DirectoryIndex index.html
> AddHandler mod_python .py .php .html .swf .pdf .js
> PythonHandler fetch
> PythonDebug On
> AllowOverride None
> Order allow,deny
> Allow from all
> </Directory>
> <IfModule dir_module>
> DirectoryIndex index.html
> </IfModule>
> <FilesMatch "^\.ht">
> Order allow,deny
> Deny from all
> Satisfy All
> </FilesMatch>
> ErrorLog "/var/log/httpd-error.log"
> LogLevel warn
> <IfModule log_config_module>
> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
> combined
> LogFormat "%h %l %u %t \"%r\" %>s %b" common
> <IfModule logio_module>
> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I
> %O" combinedio
> </IfModule>
> CustomLog "/var/log/httpd-access.log" combined
> </IfModule>
> DefaultType text/plain
> <IfModule mime_module>
> TypesConfig etc/apache22/mime.types
> AddEncoding x-compress .Z
> AddEncoding x-gzip .gz .tgz
> </IfModule>
>
>
> ________________________________
> Win a $10,000 shopping spree from Hotmail! Enter now Enter now


More information about the Mod_python mailing list