mod_python import failure on FreeBSD AMD64

Surly The Clown <[email protected]> Tue, 4 May 2010 16:12:48 -0700
Newsgroups gmane.comp.python.mod_python
Message-ID <[email protected]>
--===============1613688400==
Content-Type: multipart/alternative;
	boundary="_ea27b6fa-9289-4f80-be95-7433722a9343_"

--_ea27b6fa-9289-4f80-be95-7433722a9343_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Hello all=2C


I have two FreeBSD machines=2C both running the latest FreeBSD-8.0 release=
=2C apache-2.2.14_6=2C and mod_python-3.3.1_2. On one of the machines=2C th=
e i386 one=2C there are no problems. Everything works fine. On the other on=
e=2C an AMD64 machine=2C any attempt to access a page handled by mod_python=
 results in a 500 Internal Server Error response and the following error lo=
g:


[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
[Tue May 04 14:41:51 2010] [error] make_obcallback: could not import mod_py=
thon.apache.\n
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/mod_python/apache.py"=2C lin=
e 29=2C in <module>
    import cgi
  File "/usr/local/lib/python2.6/cgi.py"=2C line 40=2C in <module>
    import urllib
  File "/usr/local/lib/python2.6/urllib.py"=2C line 26=2C in <module>
    import socket
  File "/usr/local/lib/python2.6/socket.py"=2C line 64=2C 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'=2C '=
/usr/local/lib/python2.6/site-packages/nose-0.11.1-py2.6.egg'=2C '/usr/loca=
l/lib/python26.zip'=2C '/usr/local/lib/python2.6'=2C '/usr/local/lib/python=
2.6/plat-freebsd8'=2C '/usr/local/lib/python2.6/lib-tk'=2C '/usr/local/lib/=
python2.6/lib-old'=2C '/usr/local/lib/python2.6/lib-dynload'=2C '/usr/local=
/lib/python2.6/site-packages'=2C '/usr/local/lib/python2.6/site-packages/Nu=
meric'=2C '/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 e=
xist: /usr/home/chrisa/test/favicon.ico=2C referer: http://192.168.123.136:=
8080/fetch.py


Going into the python interpreter and entering "from _ssl import SSLError a=
s sslerror" results in no error. Doing all the imports (except _apache) fou=
nd in the apache.py file in order also results in no error. In fact=2C ente=
ring "from mod_python import apache" acts as expected=2C failing only on th=
e "import _apache" line in apache.py=2C as that is only defined when the in=
terpreter is embedded. The error with importing cgi only seems to occur whe=
n called from within apache=2C 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=2C 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 [email protected]
ServerName 192.168.123.136:8080
DocumentRoot "/usr/home/chrisa/test"
<Directory />
    AllowOverride None
    Options None
    Order deny=2Callow
    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=2Cdeny
    Allow from all
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
<FilesMatch "^\.ht">
    Order allow=2Cdeny
    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 Dire=
ctory=2C as the directory structure is a little different there.


 		 	   		 =20
_________________________________________________________________
MSN Dating: Find someone special. Start now.
http://go.microsoft.com/?linkid=3D9729707=

--_ea27b6fa-9289-4f80-be95-7433722a9343_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<style><!--
.hmmessage P
{
margin:0px=3B
padding:0px
}
body.hmmessage
{
font-size: 10pt=3B
font-family:Verdana
}
--></style>
</head>
<body class=3D'hmmessage'>
Hello all=2C<BR><BR><BR>I have two FreeBSD machines=2C both running the lat=
est FreeBSD-8.0 release=2C apache-2.2.14_6=2C and mod_python-3.3.1_2. On on=
e of the machines=2C the i386 one=2C there are no problems. Everything work=
s fine. On the other one=2C an AMD64 machine=2C any attempt to access a pag=
e handled by mod_python results in a 500 Internal Server Error response and=
 the following error log:<BR><BR><BR>[Tue May 04 14:41:34 2010] [notice] mo=
d_python: Creating 8 session mutexes based on 256 max processes and 0 max t=
hreads.<BR>[Tue May 04 14:41:34 2010] [notice] mod_python: using mutex_dire=
ctory /tmp<BR>[Tue May 04 14:41:34 2010] [notice] Apache/2.2.14 (FreeBSD) m=
od_python/3.3.1 Python/2.6.4 configured -- resuming normal operations<BR>se=
m_init: No space left on device<BR>[Tue May 04 14:41:51 2010] [error] make_=
obcallback: could not import mod_python.apache.\n<BR>Traceback (most recent=
 call last):<BR>  File "/usr/local/lib/python2.6/site-packages/mod_python/a=
pache.py"=2C line 29=2C in &lt=3Bmodule&gt=3B<BR>    import cgi<BR>  File "=
/usr/local/lib/python2.6/cgi.py"=2C line 40=2C in &lt=3Bmodule&gt=3B<BR>   =
 import urllib<BR>  File "/usr/local/lib/python2.6/urllib.py"=2C line 26=2C=
 in &lt=3Bmodule&gt=3B<BR>    import socket<BR>  File "/usr/local/lib/pytho=
n2.6/socket.py"=2C line 64=2C in &lt=3Bmodule&gt=3B<BR>    from _ssl import=
 SSLError as sslerror<BR>ImportError: cannot import name SSLError<BR>[Tue M=
ay 04 14:41:51 2010] [error] make_obcallback: Python path being used "['/us=
r/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg'=2C '/usr/l=
ocal/lib/python2.6/site-packages/nose-0.11.1-py2.6.egg'=2C '/usr/local/lib/=
python26.zip'=2C '/usr/local/lib/python2.6'=2C '/usr/local/lib/python2.6/pl=
at-freebsd8'=2C '/usr/local/lib/python2.6/lib-tk'=2C '/usr/local/lib/python=
2.6/lib-old'=2C '/usr/local/lib/python2.6/lib-dynload'=2C '/usr/local/lib/p=
ython2.6/site-packages'=2C '/usr/local/lib/python2.6/site-packages/Numeric'=
=2C '/usr/local/lib/python2.6/site-packages/gtk-2.0']".<BR>[Tue May 04 14:4=
1:51 2010] [error] get_interpreter: no interpreter callback found.<BR>[Tue =
May 04 14:41:51 2010] [error] [client 192.168.123.106] python_handler: Can'=
t get/create interpreter.<BR>[Tue May 04 14:41:51 2010] [error] [client 192=
.168.123.106] File does not exist: /usr/home/chrisa/test/favicon.ico=2C ref=
erer: http://192.168.123.136:8080/fetch.py<BR><BR><BR>Going into the python=
 interpreter and entering "from _ssl import SSLError as sslerror" results i=
n no error. Doing all the imports (except _apache) found in the apache.py f=
ile in order also results in no error. In fact=2C entering "from mod_python=
 import apache" acts as expected=2C failing only on the "import _apache" li=
ne in apache.py=2C as that is only defined when the interpreter is embedded=
. The error with importing cgi only seems to occur when called from within =
apache=2C and only on the AMD64 machine.<BR><BR><BR>I doubt this is caused =
by some bug in the AMD64 version because as far as I've been able to tell=
=2C nobody has this problem but me.<BR><BR><BR>My httpd.conf on the machine=
 which has the problem (comments stripped):<BR><BR><BR>ServerRoot "/usr/loc=
al"<BR>Listen 8080<BR>LoadModule deflate_module libexec/apache22/mod_deflat=
e.so<BR>LoadModule log_config_module libexec/apache22/mod_log_config.so<BR>=
LoadModule mime_magic_module libexec/apache22/mod_mime_magic.so<BR>LoadModu=
le unique_id_module libexec/apache22/mod_unique_id.so<BR>LoadModule mime_mo=
dule libexec/apache22/mod_mime.so<BR>LoadModule dir_module libexec/apache22=
/mod_dir.so<BR>LoadModule authz_host_module libexec/apache22/mod_authz_host=
.so<BR>LoadModule python_module libexec/apache22/mod_python.so<BR>&lt=3BIfM=
odule !mpm_netware_module&gt=3B<BR>&lt=3BIfModule !mpm_winnt_module&gt=3B<B=
R>User www<BR>Group www<BR>&lt=3B/IfModule&gt=3B<BR>&lt=3B/IfModule&gt=3B<B=
R>ServerAdmin [email protected]<BR>ServerName 192.168.123.136:8080<BR>Documen=
tRoot "/usr/home/chrisa/test"<BR>&lt=3BDirectory /&gt=3B<BR>    AllowOverri=
de None<BR>    Options None<BR>    Order deny=2Callow<BR>    Deny from all<=
BR>&lt=3B/Directory&gt=3B<BR>&lt=3BDirectory "/usr/home/chrisa/test"&gt=3B<=
BR>    Options None<BR>    DirectoryIndex index.html<BR>    AddHandler mod_=
python .py .php .html .swf .pdf .js<BR>    PythonHandler fetch<BR>    Pytho=
nDebug On<BR>    AllowOverride None<BR>    Order allow=2Cdeny<BR>    Allow =
from all<BR>&lt=3B/Directory&gt=3B<BR>&lt=3BIfModule dir_module&gt=3B<BR>  =
  DirectoryIndex index.html<BR>&lt=3B/IfModule&gt=3B<BR>&lt=3BFilesMatch "^=
\.ht"&gt=3B<BR>    Order allow=2Cdeny<BR>    Deny from all<BR>    Satisfy A=
ll<BR>&lt=3B/FilesMatch&gt=3B<BR>ErrorLog "/var/log/httpd-error.log"<BR>Log=
Level warn<BR>&lt=3BIfModule log_config_module&gt=3B<BR>    LogFormat "%h %=
l %u %t \"%r\" %&gt=3Bs %b \"%{Referer}i\" \"%{User-Agent}i\"" combined<BR>=
    LogFormat "%h %l %u %t \"%r\" %&gt=3Bs %b" common<BR>    &lt=3BIfModule=
 logio_module&gt=3B<BR>      LogFormat "%h %l %u %t \"%r\" %&gt=3Bs %b \"%{=
Referer}i\" \"%{User-Agent}i\" %I %O" combinedio<BR>    &lt=3B/IfModule&gt=
=3B<BR>    CustomLog "/var/log/httpd-access.log" combined<BR>&lt=3B/IfModul=
e&gt=3B<BR>DefaultType text/plain<BR>&lt=3BIfModule mime_module&gt=3B<BR>  =
  TypesConfig etc/apache22/mime.types<BR>    AddEncoding x-compress .Z<BR> =
   AddEncoding x-gzip .gz .tgz<BR>&lt=3B/IfModule&gt=3B<BR><BR><BR><BR>The =
one on the machine where it works differs only in DocumentRoot and Director=
y=2C as the directory structure is a little different there.<BR><BR><BR> 		=
 	   		  <br /><hr />MSN Dating: Find someone special. Start now. <a href=
=3D'http://go.microsoft.com/?linkid=3D9729702' target=3D'_new'>Start now!</=
a></body>
</html>=

--_ea27b6fa-9289-4f80-be95-7433722a9343_--

--===============1613688400==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Mod_python mailing list
[email protected]
http://mailman.modpython.org/mailman/listinfo/mod_python

--===============1613688400==--