Edgewall Software

Opened 15 years ago

Closed 15 years ago

#6218 closed defect (duplicate)

Assert read permissions of trac.ini to avoid misleading error messages

Reported by: sfish Owned by: Christopher Lenz
Priority: normal Milestone:
Component: web frontend/mod_python Version: 0.10.4
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


I've been running 4 projects on trac 0.9 for about a year now, recently I upgraded to 0.10.4 and were still able to run it like before. All my trac projects are using postgres as their dbms. Now, when I changed from running tracd (the standalone trac webserver) to use fastcgi and lighttpd, I get this "assert pysqlite" failure, even though I never had and still don't have (or use) (py)sqlite.

Here's the error output:

AssertionError	Python 2.4.2: /usr/local/bin/python
Sat Oct 20 13:09:58 2007

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
 /usr/local/lib/python2.4/site-packages/trac/web/_fcgi.py in run(self=<trac.web._fcgi.Request object>)
  568         """Runs the handler, flushes the streams, and ends the request."""
  569         try:
  570             protocolStatus, appStatus = self.server.handler(self)
  571         except:
  572             traceback.print_exc(file=self.stderr)
protocolStatus undefined, appStatus undefined, self = <trac.web._fcgi.Request object>, self.server = <trac.web._fcgi.WSGIServer object>, self.server.handler = <bound method WSGIServer.handler of <trac.web._fcgi.WSGIServer object>>
 /usr/local/lib/python2.4/site-packages/trac/web/_fcgi.py in handler(self=<trac.web._fcgi.WSGIServer object>, req=<trac.web._fcgi.Request object>)
 1254         try:
 1255             try:
 1256                 result = self.application(environ, start_response)
 1257                 try:
 1258                     for data in result:
result = None, self = <trac.web._fcgi.WSGIServer object>, self.application = <function dispatch_request>, environ = {'DOCUMENT_ROOT': '/var/lhttpd/htdocs_default/', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTPS': 'on', 'HTTP_ACCEPT': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_HOST': 'www.veloci.se:7777', ...}, start_response = <function start_response>
 /usr/local/lib/python2.4/site-packages/trac/web/main.py in dispatch_request(environ={'DOCUMENT_ROOT': '/var/lhttpd/htdocs_default/', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTPS': 'on', 'HTTP_ACCEPT': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_HOST': 'www.veloci.se:7777', ...}, start_response=<function start_response>)
  389     env = env_error = None
  390     try:
  391         env = _open_environment(env_path, run_once=run_once)
  392         if env.base_url:
  393             environ['trac.base_url'] = env.base_url
env = None, global _open_environment = <function _open_environment>, env_path = '/var/trac/projects/foo', run_once = False
 /usr/local/lib/python2.4/site-packages/trac/web/main.py in _open_environment(env_path='/var/trac/projects/foo', run_once=False)
   56     try:
   57         if not env_path in env_cache:
   58             env_cache[env_path] = open_environment(env_path)
   59         env = env_cache[env_path]
   60     finally:
global env_cache = {}, env_path = '/var/trac/projects/foo', global open_environment = <function open_environment>
 /usr/local/lib/python2.4/site-packages/trac/env.py in open_environment(env_path='/var/trac/projects/foo')
  462     env = Environment(env_path)
  463     if env.needs_upgrade():
  464         raise TracError, 'The Trac Environment needs to be upgraded. Run ' \
  465                          'trac-admin %s upgrade"' % env_path
env = <trac.env.Environment object>, env.needs_upgrade = <bound method Environment.needs_upgrade of <trac.env.Environment object>>
 /usr/local/lib/python2.4/site-packages/trac/env.py in needs_upgrade(self=<trac.env.Environment object>)
  339     def needs_upgrade(self):
  340         """Return whether the environment needs to be upgraded."""
  341         db = self.get_db_cnx()
  342         for participant in self.setup_participants:
  343             if participant.environment_needs_upgrade(db):
db undefined, self = <trac.env.Environment object>, self.get_db_cnx = <bound method Environment.get_db_cnx of <trac.env.Environment object>>
 /usr/local/lib/python2.4/site-packages/trac/env.py in get_db_cnx(self=<trac.env.Environment object>)
  201     def get_db_cnx(self):
  202         """Return a database connection from the connection pool."""
  203         return DatabaseManager(self).get_connection()
  205     def shutdown(self, tid=None):
global DatabaseManager = <class 'trac.db.api.DatabaseManager'>, self = <trac.env.Environment object>, ).get_connection undefined
 /usr/local/lib/python2.4/site-packages/trac/db/api.py in get_connection(self=<trac.db.api.DatabaseManager object>)
   74             connector, args = self._get_connector()
   75             self._cnx_pool = ConnectionPool(5, connector, **args)
   76         return self._cnx_pool.get_cnx(self.timeout or None)
   78     def shutdown(self, tid=None):
self = <trac.db.api.DatabaseManager object>, self._cnx_pool = <trac.db.pool.ConnectionPool object>, self._cnx_pool.get_cnx = <bound method ConnectionPool.get_cnx of <trac.db.pool.ConnectionPool object>>, self.timeout = 20, builtin None = None
 /usr/local/lib/python2.4/site-packages/trac/db/pool.py in get_cnx(self=<trac.db.pool.ConnectionPool object>, timeout=20)
   99                         self._cursize -= 1
  100                 elif self._maxsize and self._cursize < self._maxsize:
  101                     cnx = self._connector.get_connection(**self._kwargs)
  102                     self._cursize += 1
  103                     break
cnx undefined, self = <trac.db.pool.ConnectionPool object>, self._connector = <trac.db.sqlite_backend.SQLiteConnector object>, self._connector.get_connection = <bound method SQLiteConnector.get_connection of <trac.db.sqlite_backend.SQLiteConnector object>>, self._kwargs = {'path': u'/var/trac/projects/foo/db/trac.db'}
 /usr/local/lib/python2.4/site-packages/trac/db/sqlite_backend.py in get_connection(self=<trac.db.sqlite_backend.SQLiteConnector object>, path=u'/var/trac/projects/foo/db/trac.db', params={})
  112     def get_connection(self, path, params={}):
  113         return SQLiteConnection(path, params)
  115     def init_db(cls, path, params={}):
global SQLiteConnection = <class 'trac.db.sqlite_backend.SQLiteConnection'>, path = u'/var/trac/projects/foo/db/trac.db', params = {}
 /usr/local/lib/python2.4/site-packages/trac/db/sqlite_backend.py in __init__(self=<trac.db.sqlite_backend.SQLiteConnection object>, path=u'/var/trac/projects/foo/db/trac.db', params={})
  139     def __init__(self, path, params={}):
  140         assert have_pysqlite > 0
  141         self.cnx = None
  142         if path != ':memory:':
global have_pysqlite = 0

      args = () 

Attachments (0)

Change History (7)

comment:1 by anonymous, 15 years ago

Priority: highestnormal
Severity: normalblocker

comment:2 by sfish, 15 years ago

Component: browsermod_python frontend
Owner: changed from Christian Boos to Christopher Lenz

comment:3 by sfish, 15 years ago

Severity: blockernormal
Summary: Assert "have_pysqlite > 0" fails, even though not using pysqlite as dbms for any project.Assert read permissions of trac.ini to avoid misleading error messages

After doing some research in the trac source code I realized that for some reason trac doesn't read the trac.ini. It appeared to me that tracd was ran by the trac user, while lighttpd is ran by the lighttpd user, and since permissions to the trac projects are restricted to trac user only, the lighttpd user wasn't able to read there.

Therefore I suggest that you add some read permission check, so this kind of problems may be resolved faster and without adding unnecessary tickets.

And by the way, thanks for a great project management tool!

comment:4 by ThurnerRupert, 15 years ago

Resolution: invalid
Status: newclosed

close as requested …

in reply to:  4 comment:5 by Emmanuel Blot, 15 years ago

Resolution: invalid
Status: closedreopened

Replying to ThurnerRupert:

close as requested …

? The author of the ticket has updated the ticket summary to reflect a new need, I don't understand why you closed this ticket.

comment:6 by ThurnerRupert, 15 years ago

comment:7 by Emmanuel Blot, 15 years ago

Keywords: have_pysqlite postgres removed
Resolution: duplicate
Status: reopenedclosed

This is a duplicate of #5535.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.