Beta testing for mod_wsgi

[email protected] ha scritto:

[mark@db264282 ~/work]$ nginx -c infrastructure/nginx_trac_modwsgi.conf
2008/01/15 02:24:10 [emerg] 25298#0: glob() “/opt/local/conf/wsgi_vars”
failed (2: No such file or directory) in
infrastructure/nginx_trac_modwsgi.conf:39
Adrian how to fix this

There is a setup.py file in the mod_wsgi distribution.
It is not yet documented, but the source is easy to read.

It copies a few files (including wsgi_vars) in the destinations
directories.

Of course, you can just copy the files by hand.

[…]

Manlio P.

2008/01/15 02:52:00 [alert] 26038#0: worker process 26039 exited on
signal
11
after i try logging in
and error
Warning: Can’t synchronize with the repository (/www/svn_new does not
appear to be a Subversion repository.)

is the mod_wsgi mode really slower compared to fastcgi?

[email protected] ha scritto:

nginx -c infrastructure/nginx_trac_modwsgi.conf
2008/01/15 02:31:40 [emerg] 25478#0: glob() “/opt/local/conf/wsgi_vars”
failed (2: No such file or directory) in
infrastructure/nginx_trac_modwsgi.conf:40
[mark@db264282 ~/work]$ cd /opt/local/wsgi_temp/
-bash: cd: /opt/local/wsgi_temp/: Permission denied
adrian this is the error on using the conf file for trac nginx

This is ok.
The temporary directories are created writeable/readable on by the
owner.

By default nginx runs as “nobody”,
http://wiki.codemongers.com/NginxMainModule#user

Manlio P.

Error when trying to goto /timeline in mod_wsgi trac

please share correct trac run.wsgi file

2008/01/15 02:54:54 [error] 26048#0: *118 mod_wsgi: exception occurred
processing WSGI script
‘/home/mark/work/inf
rastructure/tracrun.wsgi’, client: 71.202.108.161, server: localhost,
request: “GET /timeline HTTP/1.1”, host:
“so
urce:2081”, referrer: “http://source:2081/wiki
2008/01/15 02:54:54 [error] 26048#0: *118 Traceback (most recent call
last):
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”
2008/01/15 02:54:54 [error] 26048#0: *118 File
“/opt/local/lib/python2.4/site-packages/Trac-0.11b1-py2.4.egg/tra
c/web/main.py”, line 381, in dispatch_request
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”
2008/01/15 02:54:54 [error] 26048#0: *118 return
_dispatch_request(req,
env, env_error)
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”
2008/01/15 02:54:54 [error] 26048#0: *118 File
“/opt/local/lib/python2.4/site-packages/Trac-0.11b1-py2.4.egg/tra
c/web/main.py”, line 415, in _dispatch_request
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”
2008/01/15 02:54:54 [error] 26048#0: *118
req.send_error(sys.exc_info(),
status=e.code, env=env, data=data)
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”
2008/01/15 02:54:54 [error] 26048#0: *118 File
“/opt/local/lib/python2.4/site-packages/Trac-0.11b1-py2.4.egg/tra
c/web/api.py”, line 358, in send_error
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”
2008/01/15 02:54:54 [error] 26048#0: *118 exc_info)
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”
2008/01/15 02:54:54 [error] 26048#0: *118 File
“/opt/local/lib/python2.4/site-packages/Trac-0.11b1-py2.4.egg/tra
c/web/main.py”, line 398, in _dispatch_request
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”
2008/01/15 02:54:54 [error] 26048#0: *118 dispatcher.dispatch(req)
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”
2008/01/15 02:54:54 [error] 26048#0: *118 File
“/opt/local/lib/python2.4/site-packages/Trac-0.11b1-py2.4.egg/tra
c/web/main.py”, line 242, in dispatch
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”
2008/01/15 02:54:54 [error] 26048#0: *118 raise HTTPInternalError(e)
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”
2008/01/15 02:54:54 [error] 26048#0: *118 HTTPInternalError: 500 Trac
Error
(

Repository
checkin
s
event provider (ChangesetModule) failed:
TracError:
/www/svn_new does not appear to be a
Subversion
repository.

You may want to see the other kind of events from the
Timeline

)
, client: 71.202.108.161, server: localhost, request: “GET /timeline
HTTP/1.1”, host: “source:2081”, referrer:
“ht
tp://source:2081/wiki”

[email protected] ha scritto:

Please, learn how to correctly post a message on a mailing list!

2008/01/15 02:52:00 [alert] 26038#0: worker process 26039 exited on
signal 11
after i try logging in
and error
Warning: Can’t synchronize with the repository (/www/svn_new does not
appear to be a Subversion repository.)

You have not configured Trac; read the Trac configuration help for
configuring the path to the Subversion repository.

However can you please send me (in private) the complete error log?
Signal 11 is a segmentation fault; I have to check if this is a problem
caused by mod_wsgi or by a Python extension module.

[…]

is the mod_wsgi mode really slower compared to fastcgi?

It depends by many factors.

Manlio P.

login logout timeline and browser modes of trac dont work with the
mod_wsgi
trac

El Mon, 14 Jan 2008 11:34:44 +0100
Manlio P. [email protected] escribió:

}
Confirmed, this is working in my home server now, but with a glich:
when /login is accessed, status 404 is returned to the client and the
returned HTML says “Environment not found”. The user will be
authenticated anyway, because the header with the session cookie is
sent in the response. You can remove the “/login” from the URL
afterwards and Trac will see you as authenticated.

You may see this behaviour at http://foobar.homeunix.org/trac/overlay
(try to login as guest).

The traceback looks like the following:

Traceback (most recent call last):
File “/usr/lib/python2.5/site-packages/trac/web/main.py”, line 19,in

import cgi
SystemError: Parent module ‘wsgi__trac?’ not loaded ,

The config file section for Trac looks contains:

env PYTHON_EGG_CACHE=/var/tmp/nginx/python-eggs;

http {
# some not-wsgi, not trac-related directives here…

server {
  listen 80;
  server_name foobar.homeunix.org;
  wsgi_python_optimize 1;
  include wsgi_vars;
  wsgi_var trac.env_parent_dir /home/trac;
  wsgi_enable_subinterpreters off;

  location /trac {
    wsgi_pass
      /usr/lib/python2.5/site-packages/trac/web/main.py
      dispatch_request;
  }
  location ~ /trac/[^/]+/login {
    auth_basic "Trac";
    auth_basic_user_file /home/trac/passwd;
    wsgi_pass
      /usr/lib/python2.5/site-packages/trac/web/main.py
      dispatch_request;
  }
  location /trac/chrome/common {
    alias /usr/lib/python2.5/site-packages/trac/htdocs;
  }
}

}

Any ideas?

Adrian P. ha scritto:

location / {

You may see this behaviour at http://foobar.homeunix.org/trac/overlay
(try to login as guest).

What is the password?
I’m unable to login.

The traceback looks like the following:

Traceback (most recent call last):
File “/usr/lib/python2.5/site-packages/trac/web/main.py”, line 19,in

import cgi
SystemError: Parent module ‘wsgi__trac?’ not loaded ,

Ok, this is a bug of mod_wsgi.
The module name is built from the name of the location used, replacing
‘/’ with ‘_’.

In you configuration, the location name is:
/trac/[^/]+/login

and this result in a invalid name for a Python module.

I have to admit that I have never thought about this possibility ;-).

It seems that I have to change the algorithm used for built the module
name.

Maybe I should add the possibility to specify the module name in the
wsgi_pass directive, or I should use an hash of the module name.

[…]

Manlio P.

Adrian P. ha scritto:

http://foobar.homeunix.org/trac/overlay (try to login as guest).

What is the password?
I’m unable to login.

Username: guest
Password: nospamatall

(They are written in the green box of the main page of the wiki, maybe
I should make the note stand out a little more :-P)

No, I simply have not read the rest of the page :).

middleware allows to only limit some URLs :wink:

You can set the middleware stack inside a specific location.

Those were my 2 cents :wink:

Thanks.

The WSGI implementation for Apache computes the md5 hash of the script
full path name, but maybe I can just use the path name, replacing ‘/’
with ‘_’.

I have to think (unfortunately lately I have very little free time to
dedicate to the development of mod_wsgi).

Manlio P.

El Mon, 28 Jan 2008 18:33:27 +0100
Manlio P. [email protected] escribió:

possibility ;-).

I see. Only if “auth_basic” and “auth_basic_user_file” could be used
inside an “if” context, we could workaround this… I think WSGI
authentication middleware could be used as well, as long as the
middleware allows to only limit some URLs :wink:

You can set the middleware stack inside a specific location.

Just letting you know: I have been able of workaround this by using the
AccountManager plugin (AccountManagerPlugin – Trac Hacks - Plugins Macros etc.)
which performs authentication by itself. Now I only need to define
trac.env_parent_dir and make a “wsgi_pass” to the Trac handler, without
additional “location” directives for authentication :wink:

The WSGI implementation for Apache computes the md5 hash of the
script full path name, but maybe I can just use the path name,
replacing ‘/’ with ‘_’.

I have to think (unfortunately lately I have very little free time to
dedicate to the development of mod_wsgi).

I think this is not an urgent issue, now I have found the
aforementioned Trac plugin, hehe. Thanks again for your great work on
mod_wsgi :slight_smile:

El Mon, 28 Jan 2008 11:47:29 +0100
Manlio P. [email protected] escribió:

What is the password?
I’m unable to login.

Username: guest
Password: nospamatall

(They are written in the green box of the main page of the wiki, maybe
I should make the note stand out a little more :-P)

The module name is built from the name of the location used,
replacing ‘/’ with ‘_’.

[…]

I have to admit that I have never thought about this possibility ;-).

I see. Only if “auth_basic” and “auth_basic_user_file” could be used
inside an “if” context, we could workaround this… I think WSGI
authentication middleware could be used as well, as long as the
middleware allows to only limit some URLs :wink:

It seems that I have to change the algorithm used for built the
module name.

Maybe I should add the possibility to specify the module name in the
wsgi_pass directive, or I should use an hash of the module name.

I don’t know whether this will be a widely-used feature, I have tested
hgweb, bazaar’s smartserver and Trac so far. Only Trac needed this. If
there isn’t a huge need for this, the manual-configuration method will
suffice.

Those were my 2 cents :wink:

Adrian P. ha scritto:

[…]
Just letting you know: I have been able of workaround this by using the
dedicate to the development of mod_wsgi).

I think this is not an urgent issue, now I have found the
aforementioned Trac plugin, hehe. Thanks again for your great work on
mod_wsgi :slight_smile:

I agree that this is not urgent, but it is however a problem that should
be solved.

Thanks Manlio P.