found a bug in WSGIPythonPath :-)

59 views
Skip to first unread message

gert

unread,
Nov 2, 2008, 8:06:34 PM11/2/08
to modwsgi
This is going to take aaaaaages to explain, and probably will not be
reproducible on mac either, dam*t Graham when are going to get rid of
that expensive crap.

http://87.98.218.86/appwsgi/www/upload2/upload.htm

Normally you see a yellow square if your flash 10 plugin is working...
i doubt on safari ch*t
If you click on it, it start uploading stuff on a really nice way that
you can customize to make it look really fancy with progress bars and
stuff without reloading a single page. Bless web 3.0 and the open flex
compiler :-)

But the bug is I had to type in this url before wsgi figured out
WSGIPythonPath
http://87.98.218.86/appwsgi/www/upload2/upload.py

So how in gods name am I going to explain this to you so you know what
is going on :-)

Wsgi Trunk version embeded mode
Prefork Server version: Apache/2.2.9 (Ubuntu) PHP SSL


Graham Dumpleton

unread,
Nov 2, 2008, 9:43:22 PM11/2/08
to mod...@googlegroups.com
2008/11/3 gert <gert.c...@gmail.com>:

Test with mod_wsgi 2.3 and tell me if it does the same thing as
recently did some fiddling with WSGIPythonPath and python-path in
trunk. If you can't go back to 2.3, check out revision 1101 of trunk
instead and try it.

Also, what code is in WSGI script file that:

http://87.98.218.86/appwsgi/www/upload2/upload.py

maps to? In particular, anything that changes sys.path or calls
site.addsitedir().

If you are doing path manipulations in that script file and have used
WSGIApplicationGroup to run lots of scripts in same sub interpreter,
you may have caused an ordering dependency if other script files
import stuff but you have not done similar path change in those script
files.

Also try augmenting scripts with debug which outputs sys.path so you
can show what value it has before and after execution of particular
scripts.

Graham

gert

unread,
Nov 2, 2008, 10:19:46 PM11/2/08
to modwsgi
http://91.121.53.159/appwsgi/www/upload2/upload.htm

[Mon Nov 03 04:09:13 2008] [info] Init: Seeding PRNG with 0 bytes of
entropy
[Mon Nov 03 04:09:13 2008] [info] Init: Generating temporary RSA
private keys (512/1024 bits)
[Mon Nov 03 04:09:14 2008] [info] Init: Generating temporary DH
parameters (512/1024 bits)
[Mon Nov 03 04:09:14 2008] [info] Init: Initializing (virtual) servers
for SSL
[Mon Nov 03 04:09:14 2008] [info] mod_ssl/2.2.9 compiled against
Server: Apache/2.2.9, Library: OpenSSL/0.9.8g
[Mon Nov 03 04:09:14 2008] [info] mod_wsgi: Initializing Python.
[Mon Nov 03 04:09:14 2008] [info] mod_wsgi (pid=6865): Attach
interpreter ''.
[Mon Nov 03 04:09:14 2008] [info] mod_wsgi (pid=6865): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:09:14 2008] [info] mod_wsgi (pid=6867): Attach
interpreter ''.
[Mon Nov 03 04:09:14 2008] [info] mod_wsgi (pid=6867): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:09:14 2008] [info] mod_wsgi (pid=6868): Attach
interpreter ''.
[Mon Nov 03 04:09:14 2008] [info] mod_wsgi (pid=6868): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:09:14 2008] [info] mod_wsgi (pid=6869): Attach
interpreter ''.
[Mon Nov 03 04:09:14 2008] [info] mod_wsgi (pid=6869): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:09:14 2008] [info] mod_wsgi (pid=6870): Attach
interpreter ''.
[Mon Nov 03 04:09:14 2008] [info] mod_wsgi (pid=6870): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:09:14 2008] [notice] Apache/2.2.9 (Ubuntu) mod_ssl/
2.2.9 OpenSSL/0.9.8g mod_wsgi/3.0-TRUNK Python/2.5.2 configured --
resuming normal operations
[Mon Nov 03 04:09:14 2008] [info] Server built: Sep 19 2008 13:43:21
[Mon Nov 03 04:10:49 2008] [info] mod_wsgi (pid=7119): Attach
interpreter ''.
[Mon Nov 03 04:10:49 2008] [info] mod_wsgi (pid=7119): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:11:01 2008] [info] mod_wsgi (pid=7176): Attach
interpreter ''.
[Mon Nov 03 04:11:01 2008] [info] mod_wsgi (pid=7176): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:11:05 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=6868, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:11:06 2008] [info] mod_wsgi (pid=7204): Attach
interpreter ''.
[Mon Nov 03 04:11:06 2008] [info] mod_wsgi (pid=7204): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:11:16 2008] [error] [client 81.211.123.66] client sent
HTTP/1.1 request without hostname (see RFC2616 section 14.23): /
w00tw00t.at.ISC.SANS.DFind:)
[Mon Nov 03 04:12:59 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=6870, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:13:10 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=7119, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.

this looks normal its from a other server with a older trunk version
but i don't know the number anymore because i did a wget and deleted
the files
anyway i am looking into it which version that does not work

Graham Dumpleton

unread,
Nov 2, 2008, 10:31:19 PM11/2/08
to mod...@googlegroups.com
For reference, the issue for the change in sys.path ordering is:

http://code.google.com/p/modwsgi/issues/detail?id=112

When you use WSGIPythonPath or python-path option, any newly added
directories were added to the end of sys.path. After the change,
sys.path is analysed and newly added directories are shifted in order
as a block from end of sys.path to beginning of sys.path.

The point in doing this is to ensure that newly added directories take
precedence over Python standard module directories and site-packages
directory.

If this is not done, and you don't make main Apache/mod_wsgi use a
virgin virtual environment using WSGIPythonHome, when using per
application/user virtual environments with WSGIPythonPath and
python-path, then the user specific modules can't override main ones.

Note that on Windows WSGIPythonHome doesn't exist and so this was
always a problem there as you could point at virgin virtual
environment.

End result of this may be that if in your new directories added you
have modules with same names as standard modules, they will now
override them. This could be a problem, but then you should be
avoiding name space collisions by not naming modules same as standard
ones.

BTW, this reordering doesn't apply when you cal site.addsitedir() in
the WSGI script file itself.

Also, don't post a dribble of messages containing random thoughts as
you work through it. The important thing at this moment is for you to
dump the value of sys.path into error log and validate that it does at
least have all directories you expect it to for script that is
failing. Also, ensure you also dump out mod_wsgi.process_group and
mod_wsgi.application_group from WSGI environ dictionary and validate
that they are actually correct for where you think code should be
executing and for which WSGIPythonPath or python-path option has been
defined.

Graham

2008/11/3 gert <gert.c...@gmail.com>:

gert

unread,
Nov 2, 2008, 10:32:11 PM11/2/08
to modwsgi
revision 1105 is broken, the other one what ever version it was did
work :P

[Mon Nov 03 04:28:16 2008] [info] Init: Seeding PRNG with 0 bytes of
entropy
[Mon Nov 03 04:28:16 2008] [info] Init: Generating temporary RSA
private keys (512/1024 bits)
[Mon Nov 03 04:28:16 2008] [info] Init: Generating temporary DH
parameters (512/1024 bits)
[Mon Nov 03 04:28:16 2008] [info] Init: Initializing (virtual) servers
for SSL
[Mon Nov 03 04:28:16 2008] [info] mod_ssl/2.2.9 compiled against
Server: Apache/2.2.9, Library: OpenSSL/0.9.8g
[Mon Nov 03 04:28:16 2008] [info] Init: Seeding PRNG with 0 bytes of
entropy
[Mon Nov 03 04:28:16 2008] [info] Init: Generating temporary RSA
private keys (512/1024 bits)
[Mon Nov 03 04:28:16 2008] [info] Init: Generating temporary DH
parameters (512/1024 bits)
[Mon Nov 03 04:28:16 2008] [info] Init: Initializing (virtual) servers
for SSL
[Mon Nov 03 04:28:16 2008] [info] mod_ssl/2.2.9 compiled against
Server: Apache/2.2.9, Library: OpenSSL/0.9.8g
[Mon Nov 03 04:28:16 2008] [info] mod_wsgi: Initializing Python.
[Mon Nov 03 04:28:16 2008] [info] mod_wsgi (pid=9471): Attach
interpreter ''.
[Mon Nov 03 04:28:16 2008] [info] mod_wsgi (pid=9471): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:28:16 2008] [info] mod_wsgi (pid=9473): Attach
interpreter ''.
[Mon Nov 03 04:28:16 2008] [info] mod_wsgi (pid=9473): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:28:16 2008] [info] mod_wsgi (pid=9474): Attach
interpreter ''.
[Mon Nov 03 04:28:16 2008] [info] mod_wsgi (pid=9474): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:28:16 2008] [info] mod_wsgi (pid=9475): Attach
interpreter ''.
[Mon Nov 03 04:28:16 2008] [info] mod_wsgi (pid=9475): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:28:16 2008] [info] mod_wsgi (pid=9476): Attach
interpreter ''.
[Mon Nov 03 04:28:16 2008] [info] mod_wsgi (pid=9476): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:28:16 2008] [notice] Apache/2.2.9 (Ubuntu) mod_ssl/
2.2.9 OpenSSL/0.9.8g mod_wsgi/3.0-TRUNK Python/2.5.2 configured --
resuming normal operations
[Mon Nov 03 04:28:16 2008] [info] Server built: Sep 19 2008 13:43:21
[Mon Nov 03 04:28:22 2008] [info] mod_wsgi (pid=9477): Attach
interpreter ''.
[Mon Nov 03 04:28:22 2008] [info] mod_wsgi (pid=9477): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:28:23 2008] [info] mod_wsgi (pid=9478): Attach
interpreter ''.
[Mon Nov 03 04:28:23 2008] [info] mod_wsgi (pid=9478): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:28:23 2008] [info] mod_wsgi (pid=9479): Attach
interpreter ''.
[Mon Nov 03 04:28:23 2008] [info] mod_wsgi (pid=9479): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:28:29 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=9474, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:28:29 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=9474): Target WSGI script '/srv/www/appwsgi/www/upload2/
upload.py' cannot be loaded as Python module.
[Mon Nov 03 04:28:29 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=9474): Exception occurred processing WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:28:29 2008] [error] [client 80.200.208.100] Traceback
(most recent call last):
[Mon Nov 03 04:28:29 2008] [error] [client 80.200.208.100] File "/
srv/www/appwsgi/www/upload2/upload.py", line 3, in <module>
[Mon Nov 03 04:28:29 2008] [error] [client 80.200.208.100] import
re,sessions
[Mon Nov 03 04:28:29 2008] [error] [client 80.200.208.100]
ImportError: No module named apache
[Mon Nov 03 04:28:40 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=9475, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:28:40 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=9475): Target WSGI script '/srv/www/appwsgi/www/upload2/
upload.py' cannot be loaded as Python module.
[Mon Nov 03 04:28:40 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=9475): Exception occurred processing WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:28:40 2008] [error] [client 80.200.208.100] Traceback
(most recent call last):
[Mon Nov 03 04:28:40 2008] [error] [client 80.200.208.100] File "/
srv/www/appwsgi/www/upload2/upload.py", line 3, in <module>
[Mon Nov 03 04:28:40 2008] [error] [client 80.200.208.100] import
re,sessions
[Mon Nov 03 04:28:40 2008] [error] [client 80.200.208.100]
ImportError: No module named apache

Graham Dumpleton

unread,
Nov 2, 2008, 10:40:34 PM11/2/08
to mod...@googlegroups.com
Apply temporary patch:

Index: mod_wsgi.c
===================================================================
--- mod_wsgi.c (revision 1105)
+++ mod_wsgi.c (working copy)
@@ -4260,6 +4260,7 @@

module = NULL;

+#if 0
if (!wsgi_daemon_pool) {
module = PyImport_ImportModule("apache");

@@ -4309,6 +4310,7 @@
AP_SERVER_MINORVERSION_NUMBER));

Py_DECREF(module);
+#endif

/*
* Restore previous thread state. Only need to


recompile and tell me if problem goes away.

Also just clarify whether anywhere in your code you actually had:

import apache

Graham

2008/11/3 gert <gert.c...@gmail.com>:

gert

unread,
Nov 2, 2008, 10:46:32 PM11/2/08
to modwsgi
you can browse every line of the code here with coloring, i love
colors :-)
http://code.google.com/p/appwsgi/source/browse/trunk#trunk/www/upload2

recompiling just a sec

my apache conf

User www-data
Group www-data

Listen 80
Listen 443

ServerRoot "/usr/lib/apache2"
ErrorLog "/var/log/apache2/error.log"
LogLevel info

LoadModule ssl_module modules/mod_ssl.so
SSLCertificateFile /etc/apache2/ca.pem
SSLCertificateKeyFile /etc/apache2/key.pem
SSLSessionCache dbm:/var/log/apache2/ssl_cache
SSLSessionCacheTimeout 600
SSLEngine Off

LoadModule wsgi_module modules/mod_wsgi.so
WSGIProcessGroup %{GLOBAL}
WSGIApplicationGroup %{GLOBAL}
WSGIPythonPath /srv/www/appwsgi/www/lib

LoadModule mime_module modules/mod_mime.so
TypesConfig /etc/mime.types
DefaultType text/plain
AddHandler wsgi-script .py
AddType text/xml .py

LoadModule deflate_module modules/mod_deflate.so
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/
javascript text/css

LoadModule authz_host_module modules/mod_authz_host.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so

ServerAdmin gert.c...@gmail.com
ServerName 127.0.0.1:80
DocumentRoot "/srv/www"

<Directory />
Options ExecCGI Indexes FollowSymLinks
DirectoryIndex index.htm
IndexIgnore .htaccess .??* *.pyc
Order Deny,Allow
Allow from all
</Directory>

gert

unread,
Nov 2, 2008, 10:55:39 PM11/2/08
to modwsgi
nope

[Mon Nov 03 04:51:48 2008] [info] Init: Seeding PRNG with 0 bytes of
entropy
[Mon Nov 03 04:51:48 2008] [info] Init: Generating temporary RSA
private keys (512/1024 bits)
[Mon Nov 03 04:51:49 2008] [info] Init: Generating temporary DH
parameters (512/1024 bits)
[Mon Nov 03 04:51:49 2008] [info] Init: Initializing (virtual) servers
for SSL
[Mon Nov 03 04:51:49 2008] [info] mod_ssl/2.2.9 compiled against
Server: Apache/2.2.9, Library: OpenSSL/0.9.8g
[Mon Nov 03 04:51:49 2008] [info] mod_wsgi: Initializing Python.
[Mon Nov 03 04:51:49 2008] [info] mod_wsgi (pid=11585): Attach
interpreter ''.
[Mon Nov 03 04:51:49 2008] [info] mod_wsgi (pid=11585): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:51:49 2008] [info] mod_wsgi (pid=11587): Attach
interpreter ''.
[Mon Nov 03 04:51:49 2008] [info] mod_wsgi (pid=11587): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:51:49 2008] [info] mod_wsgi (pid=11588): Attach
interpreter ''.
[Mon Nov 03 04:51:49 2008] [info] mod_wsgi (pid=11588): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:51:49 2008] [info] mod_wsgi (pid=11589): Attach
interpreter ''.
[Mon Nov 03 04:51:49 2008] [info] mod_wsgi (pid=11589): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:51:49 2008] [info] mod_wsgi (pid=11590): Attach
interpreter ''.
[Mon Nov 03 04:51:49 2008] [info] mod_wsgi (pid=11590): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:51:49 2008] [notice] Apache/2.2.9 (Ubuntu) mod_ssl/
2.2.9 OpenSSL/0.9.8g mod_wsgi/3.0-TRUNK Python/2.5.2 configured --
resuming normal operations
[Mon Nov 03 04:51:49 2008] [info] Server built: Sep 19 2008 13:43:21
[Mon Nov 03 04:52:05 2008] [info] mod_wsgi (pid=11647): Attach
interpreter ''.
[Mon Nov 03 04:52:05 2008] [info] mod_wsgi (pid=11647): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:52:15 2008] [info] mod_wsgi (pid=11651): Attach
interpreter ''.
[Mon Nov 03 04:52:15 2008] [info] mod_wsgi (pid=11651): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:52:18 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=11588, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:52:18 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=11588): Target WSGI script '/srv/www/appwsgi/www/upload2/
upload.py' cannot be loaded as Python module.
[Mon Nov 03 04:52:18 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=11588): Exception occurred processing WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:52:18 2008] [error] [client 80.200.208.100] Traceback
(most recent call last):
[Mon Nov 03 04:52:18 2008] [error] [client 80.200.208.100] File "/
srv/www/appwsgi/www/upload2/upload.py", line 3, in <module>
[Mon Nov 03 04:52:18 2008] [error] [client 80.200.208.100] import
re,sessions
[Mon Nov 03 04:52:18 2008] [error] [client 80.200.208.100]
ImportError: No module named mod_wsgi
[Mon Nov 03 04:52:19 2008] [info] mod_wsgi (pid=11652): Attach
interpreter ''.
[Mon Nov 03 04:52:19 2008] [info] mod_wsgi (pid=11652): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 04:52:42 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=11589, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:52:42 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=11589): Target WSGI script '/srv/www/appwsgi/www/upload2/
upload.py' cannot be loaded as Python module.
[Mon Nov 03 04:52:42 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=11589): Exception occurred processing WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:52:42 2008] [error] [client 80.200.208.100] Traceback
(most recent call last):
[Mon Nov 03 04:52:42 2008] [error] [client 80.200.208.100] File "/
srv/www/appwsgi/www/upload2/upload.py", line 3, in <module>
[Mon Nov 03 04:52:42 2008] [error] [client 80.200.208.100] import
re,sessions
[Mon Nov 03 04:52:42 2008] [error] [client 80.200.208.100]
ImportError: No module named mod_wsgi
[Mon Nov 03 04:52:48 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=11590, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:52:48 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=11590): Target WSGI script '/srv/www/appwsgi/www/upload2/
upload.py' cannot be loaded as Python module.
[Mon Nov 03 04:52:48 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=11590): Exception occurred processing WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 04:52:48 2008] [error] [client 80.200.208.100] Traceback
(most recent call last):
[Mon Nov 03 04:52:48 2008] [error] [client 80.200.208.100] File "/
srv/www/appwsgi/www/upload2/upload.py", line 3, in <module>
[Mon Nov 03 04:52:48 2008] [error] [client 80.200.208.100] import
re,sessions
[Mon Nov 03 04:52:48 2008] [error] [client 80.200.208.100]
ImportError: No module named mod_wsgi

root@r12276:/srv/mod_wsgi# patch < patch
patching file mod_wsgi.c
Reversed (or previously applied) patch detected!

so i gues i did patch it ok ?

Graham Dumpleton

unread,
Nov 2, 2008, 10:59:03 PM11/2/08
to mod...@googlegroups.com
2008/11/3 gert <gert.c...@gmail.com>:
>
> nope

>
> root@r12276:/srv/mod_wsgi# patch < patch
> patching file mod_wsgi.c
> Reversed (or previously applied) patch detected!
>
> so i gues i did patch it ok ?

Why do you always make me do the hard work. You should be doing the
hard working in tracking down the problem. ;-(

svn revert mod_wsgi.c

patch -p0 < patch

I ask again, do you have:

import apache

anywhere in your code? I don't want to have to go trolling through
your code myself.

Graham

gert

unread,
Nov 2, 2008, 11:14:53 PM11/2/08
to modwsgi
nope i do not have import apache

root@r12276:/srv/mod_wsgi# svn revert mod_wsgi.c
Reverted 'mod_wsgi.c'
root@r12276:/srv/mod_wsgi# patch -p0 < patch
patching file mod_wsgi.c
Hunk #2 succeeded at 4310 with fuzz 1.
root@r12276:/srv/mod_wsgi#

root@r12276:/srv/mod_wsgi# make clean
rm -rf .libs
rm -f mod_wsgi.o mod_wsgi.la mod_wsgi.lo mod_wsgi.slo mod_wsgi.loT
rm -f config.log config.status
rm -rf autom4te.cache
root@r12276:/srv/mod_wsgi# make
/usr/bin/apxs2 -c -I/usr/include/python2.5 -DNDEBUG mod_wsgi.c -Wl,-
L/usr/lib/python2.5/config -Wl,-lpython2.5 -Wl,-lpthread -Wl,-ldl -Wl,-
lutil -Wl,-lm
/usr/share/apr-1.0/build/libtool --silent --mode=compile --tag=disable-
static i486-linux-gnu-gcc -prefer-pic -DLINUX=2 -D_GNU_SOURCE -
D_LARGEFILE64_SOURCE -D_REENTRANT -I/usr/include/apr-1.0 -I/usr/
include/mysql -I/usr/include/openssl -I/usr/include/postgresql -I/usr/
include/xmltok -pthread -I/usr/include/apache2 -I/usr/include/
apr-1.0 -I/usr/include/apr-1.0 -I/usr/include/postgresql -I/usr/
include/mysql -I/usr/include/python2.5 -DNDEBUG -c -o mod_wsgi.lo
mod_wsgi.c && touch mod_wsgi.slo
mod_wsgi.c: In function 'wsgi_log_script_error':
mod_wsgi.c:6726: warning: format not a string literal and no format
arguments
/usr/share/apr-1.0/build/libtool --silent --mode=link --tag=disable-
static i486-linux-gnu-gcc -o mod_wsgi.la -rpath /usr/lib/apache2/
modules -module -avoid-version mod_wsgi.lo -Wl,-L/usr/lib/python2.5/
config -Wl,-lpython2.5 -Wl,-lpthread -Wl,-ldl -Wl,-lutil -Wl,-lm
root@r12276:/srv/mod_wsgi# make install
/usr/bin/apxs2 -i -S LIBEXECDIR=/usr/lib/apache2/modules -n 'mod_wsgi'
mod_wsgi.la
/usr/share/apache2/build/instdso.sh SH_LIBTOOL='/usr/share/apr-1.0/
build/libtool' mod_wsgi.la /usr/lib/apache2/modules
/usr/share/apr-1.0/build/libtool --mode=install cp mod_wsgi.la /usr/
lib/apache2/modules/
cp .libs/mod_wsgi.so /usr/lib/apache2/modules/mod_wsgi.so
cp .libs/mod_wsgi.lai /usr/lib/apache2/modules/mod_wsgi.la
PATH="$PATH:/sbin" ldconfig -n /usr/lib/apache2/modules
----------------------------------------------------------------------
Libraries have been installed in:
/usr/lib/apache2/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 644 /usr/lib/apache2/modules/mod_wsgi.so
root@r12276:/srv/mod_wsgi#

[Mon Nov 03 05:11:17 2008] [info] Init: Seeding PRNG with 0 bytes of
entropy
[Mon Nov 03 05:11:17 2008] [info] Init: Generating temporary RSA
private keys (512/1024 bits)
[Mon Nov 03 05:11:17 2008] [info] Init: Generating temporary DH
parameters (512/1024 bits)
[Mon Nov 03 05:11:17 2008] [info] Init: Initializing (virtual) servers
for SSL
[Mon Nov 03 05:11:17 2008] [info] mod_ssl/2.2.9 compiled against
Server: Apache/2.2.9, Library: OpenSSL/0.9.8g
[Mon Nov 03 05:11:17 2008] [info] Init: Seeding PRNG with 0 bytes of
entropy
[Mon Nov 03 05:11:17 2008] [info] Init: Generating temporary RSA
private keys (512/1024 bits)
[Mon Nov 03 05:11:18 2008] [info] Init: Generating temporary DH
parameters (512/1024 bits)
[Mon Nov 03 05:11:18 2008] [info] Init: Initializing (virtual) servers
for SSL
[Mon Nov 03 05:11:18 2008] [info] mod_ssl/2.2.9 compiled against
Server: Apache/2.2.9, Library: OpenSSL/0.9.8g
[Mon Nov 03 05:11:18 2008] [info] mod_wsgi: Initializing Python.
[Mon Nov 03 05:11:18 2008] [info] mod_wsgi (pid=13933): Attach
interpreter ''.
[Mon Nov 03 05:11:18 2008] [info] mod_wsgi (pid=13933): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:11:18 2008] [info] mod_wsgi (pid=13935): Attach
interpreter ''.
[Mon Nov 03 05:11:18 2008] [info] mod_wsgi (pid=13935): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:11:18 2008] [info] mod_wsgi (pid=13936): Attach
interpreter ''.
[Mon Nov 03 05:11:18 2008] [info] mod_wsgi (pid=13936): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:11:18 2008] [info] mod_wsgi (pid=13937): Attach
interpreter ''.
[Mon Nov 03 05:11:18 2008] [info] mod_wsgi (pid=13937): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:11:18 2008] [info] mod_wsgi (pid=13938): Attach
interpreter ''.
[Mon Nov 03 05:11:18 2008] [info] mod_wsgi (pid=13938): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:11:18 2008] [notice] Apache/2.2.9 (Ubuntu) mod_ssl/
2.2.9 OpenSSL/0.9.8g mod_wsgi/3.0-TRUNK Python/2.5.2 configured --
resuming normal operations
[Mon Nov 03 05:11:18 2008] [info] Server built: Sep 19 2008 13:43:21
[Mon Nov 03 05:11:31 2008] [info] mod_wsgi (pid=13945): Attach
interpreter ''.
[Mon Nov 03 05:11:31 2008] [info] mod_wsgi (pid=13945): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:11:32 2008] [info] mod_wsgi (pid=13946): Attach
interpreter ''.
[Mon Nov 03 05:11:32 2008] [info] mod_wsgi (pid=13946): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:11:32 2008] [info] mod_wsgi (pid=13947): Attach
interpreter ''.
[Mon Nov 03 05:11:32 2008] [info] mod_wsgi (pid=13947): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:11:39 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=13936, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 05:11:39 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=13936): Target WSGI script '/srv/www/appwsgi/www/upload2/
upload.py' cannot be loaded as Python module.
[Mon Nov 03 05:11:39 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=13936): Exception occurred processing WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 05:11:39 2008] [error] [client 80.200.208.100] Traceback
(most recent call last):
[Mon Nov 03 05:11:39 2008] [error] [client 80.200.208.100] File "/
srv/www/appwsgi/www/upload2/upload.py", line 3, in <module>
[Mon Nov 03 05:11:39 2008] [error] [client 80.200.208.100] import
re,sessions
[Mon Nov 03 05:11:39 2008] [error] [client 80.200.208.100]
ImportError: No module named mod_wsgi
[Mon Nov 03 05:11:44 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=13937, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 05:11:44 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=13937): Target WSGI script '/srv/www/appwsgi/www/upload2/
upload.py' cannot be loaded as Python module.
[Mon Nov 03 05:11:44 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=13937): Exception occurred processing WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 05:11:44 2008] [error] [client 80.200.208.100] Traceback
(most recent call last):
[Mon Nov 03 05:11:44 2008] [error] [client 80.200.208.100] File "/
srv/www/appwsgi/www/upload2/upload.py", line 3, in <module>
[Mon Nov 03 05:11:44 2008] [error] [client 80.200.208.100] import
re,sessions
[Mon Nov 03 05:11:44 2008] [error] [client 80.200.208.100]
ImportError: No module named mod_wsgi
[Mon Nov 03 05:11:49 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=13938, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 05:11:49 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=13938): Target WSGI script '/srv/www/appwsgi/www/upload2/
upload.py' cannot be loaded as Python module.
[Mon Nov 03 05:11:49 2008] [error] [client 80.200.208.100] mod_wsgi
(pid=13938): Exception occurred processing WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 05:11:49 2008] [error] [client 80.200.208.100] Traceback
(most recent call last):
[Mon Nov 03 05:11:49 2008] [error] [client 80.200.208.100] File "/
srv/www/appwsgi/www/upload2/upload.py", line 3, in <module>
[Mon Nov 03 05:11:49 2008] [error] [client 80.200.208.100] import
re,sessions
[Mon Nov 03 05:11:49 2008] [error] [client 80.200.208.100]
ImportError: No module named mod_wsgi

same result does not work

Graham Dumpleton

unread,
Nov 2, 2008, 11:21:08 PM11/2/08
to mod...@googlegroups.com
2008/11/3 gert <gert.c...@gmail.com>:

>
> nope i do not have import apache
>
> root@r12276:/srv/mod_wsgi# svn revert mod_wsgi.c
> Reverted 'mod_wsgi.c'
> root@r12276:/srv/mod_wsgi# patch -p0 < patch
> patching file mod_wsgi.c
> Hunk #2 succeeded at 4310 with fuzz 1.
> root@r12276:/srv/mod_wsgi#
>
> ...

>
> [Mon Nov 03 05:11:49 2008] [error] [client 80.200.208.100]
> ImportError: No module named mod_wsgi
>
> same result does not work

Does tell me that I am tweaking the right area of the code as now
complains about 'mod_wsgi' module which is just before bit of code I
got you to disable. :-)

No need for you to look further as know now what I probably need to do.

Graham

Graham Dumpleton

unread,
Nov 2, 2008, 11:28:44 PM11/2/08
to mod...@googlegroups.com
2008/11/3 Graham Dumpleton <graham.d...@gmail.com>:

svn revert mod_wsgi.c

patch -p0 < patchbelow.txt

Index: mod_wsgi.c
===================================================================
--- mod_wsgi.c (revision 1105)
+++ mod_wsgi.c (working copy)

@@ -4201,11 +4201,12 @@

if (module) {
PyErr_Print();
- PyErr_Clear();

PyDict_DelItemString(modules, "mod_wsgi");
}

+ PyErr_Clear();
+
module = PyImport_AddModule("mod_wsgi");

Py_INCREF(module);
@@ -4277,12 +4278,13 @@
Py_END_ALLOW_THREADS

PyErr_Print();
- PyErr_Clear();

PyDict_DelItemString(modules, "apache");

module = NULL;
}
+
+ PyErr_Clear();
}
else {
Py_BEGIN_ALLOW_THREADS

gert

unread,
Nov 2, 2008, 11:38:24 PM11/2/08
to modwsgi
BINGO :-)

[Mon Nov 03 05:35:49 2008] [info] Init: Seeding PRNG with 0 bytes of
entropy
[Mon Nov 03 05:35:49 2008] [info] Init: Generating temporary RSA
private keys (512/1024 bits)
[Mon Nov 03 05:35:49 2008] [info] Init: Generating temporary DH
parameters (512/1024 bits)
[Mon Nov 03 05:35:49 2008] [info] Init: Initializing (virtual) servers
for SSL
[Mon Nov 03 05:35:49 2008] [info] mod_ssl/2.2.9 compiled against
Server: Apache/2.2.9, Library: OpenSSL/0.9.8g
[Mon Nov 03 05:35:49 2008] [info] mod_wsgi: Initializing Python.
[Mon Nov 03 05:35:49 2008] [info] mod_wsgi (pid=16845): Attach
interpreter ''.
[Mon Nov 03 05:35:49 2008] [info] mod_wsgi (pid=16845): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:35:49 2008] [info] mod_wsgi (pid=16847): Attach
interpreter ''.
[Mon Nov 03 05:35:49 2008] [info] mod_wsgi (pid=16847): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:35:49 2008] [info] mod_wsgi (pid=16848): Attach
interpreter ''.
[Mon Nov 03 05:35:49 2008] [info] mod_wsgi (pid=16848): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:35:49 2008] [info] mod_wsgi (pid=16849): Attach
interpreter ''.
[Mon Nov 03 05:35:49 2008] [info] mod_wsgi (pid=16849): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:35:49 2008] [info] mod_wsgi (pid=16850): Attach
interpreter ''.
[Mon Nov 03 05:35:49 2008] [info] mod_wsgi (pid=16850): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:35:49 2008] [notice] Apache/2.2.9 (Ubuntu) mod_ssl/
2.2.9 OpenSSL/0.9.8g mod_wsgi/3.0-TRUNK Python/2.5.2 configured --
resuming normal operations
[Mon Nov 03 05:35:49 2008] [info] Server built: Sep 19 2008 13:43:21
[Mon Nov 03 05:35:55 2008] [info] mod_wsgi (pid=16851): Attach
interpreter ''.
[Mon Nov 03 05:35:55 2008] [info] mod_wsgi (pid=16851): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:36:05 2008] [info] mod_wsgi (pid=16908): Attach
interpreter ''.
[Mon Nov 03 05:36:05 2008] [info] mod_wsgi (pid=16908): Adding '/srv/
www/appwsgi/www/lib' to path.
[Mon Nov 03 05:36:12 2008] [info] [client 80.200.208.100] mod_wsgi
(pid=16848, process='', application=''): Loading WSGI script '/srv/www/
appwsgi/www/upload2/upload.py'.
[Mon Nov 03 05:36:12 2008] [info] mod_wsgi (pid=16913): Attach
interpreter ''.
[Mon Nov 03 05:36:12 2008] [info] mod_wsgi (pid=16913): Adding '/srv/
www/appwsgi/www/lib' to path.

Graham Dumpleton

unread,
Nov 2, 2008, 11:46:20 PM11/2/08
to mod...@googlegroups.com
Hmmm. The only explanation I can come up with for this is that
previously was always creating a new thread state object when doing
the initialisation. For main interpreter though, now do it properly
and ensure use simplified GIL state API. Because wasn't clearing
exception condition in correct spot, that now persists in thread state
held by simplified GIL state API. Previously, the thread state would
be thrown away and that there was an error condition wasn't an issue.

And you probably thought it would be hard to find. I do grant it may
have been hard for you to explain. :-)

Graham

2008/11/3 gert <gert.c...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages