[mod_python] mod_python import failure on FreeBSD AMD64

Graham Dumpleton graham.dumpleton at gmail.com
Tue May 4 19:30:10 EDT 2010


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

> [Tue May 04 14:41:51 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 14:41:51 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 14:41:51 2010] [error] get_interpreter: no interpreter callback
> found.
> [Tue May 04 14:41:51 2010] [error] [client 192.168.123.106] python_handler:
> Can't get/create interpreter.
> [Tue May 04 14:41:51 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
>
>
> Going into the python interpreter and entering "from _ssl import SSLError as
> sslerror" results in no error. Doing all the imports (except _apache) found
> in the apache.py file in order also results in no error. In fact, entering
> "from mod_python import apache" acts as expected, failing only on the
> "import _apache" line in apache.py, as that is only defined when the
> interpreter is embedded. The error with importing cgi only seems to occur
> when called from within apache, and only on the AMD64 machine.
>
>
> I doubt this is caused by some bug in the AMD64 version because as far as
> I've been able to tell, nobody has this problem but me.
>
>
> My httpd.conf on the machine which has the problem (comments stripped):
>
>
> 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"
> <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>
>
>
>
> The one on the machine where it works differs only in DocumentRoot and
> Directory, as the directory structure is a little different there.
>
>
>
> ________________________________
> MSN Dating: Find someone special. Start now. Start now!
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>


More information about the Mod_python mailing list