#10044 closed defect (fixed)
Unhelpful error message when config permissions are incorrect for reading
Reported by: | verm | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 0.12.3 |
Component: | general | Version: | 0.12dev |
Severity: | normal | Keywords: | config permissions |
Cc: | verm@…, Thijs Triemstra, Jun Omae | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
After a fresh installation using trac-admin initenv
I was unable to load the instance from the web with this error message:
TimeoutError: Unable to get database connection within 0 seconds. (TracError: Database "/usr/www/trac/db/trac.db" not found.)
MY backend was set to MySQL (and initenv even populated the database). After much debugging I figured out the problem after discovering it worked successfully using tracd.
The config file was not readable by the webserver, this problem can be reproduced by a chmod 000 conf/trac.ini
.
Attachments (1)
Change History (20)
comment:1 by , 14 years ago
Cc: | added |
---|
comment:2 by , 14 years ago
follow-ups: 4 14 comment:3 by , 14 years ago
On Windows, when the file is not readable I get the appropriate "TracError: IOError: [Errno 13] Permission denied: '…'" (trunk). However I get an "TracError: The Trac Environment needs to be upgraded." in case the trac.ini file is missing. Not good either.
This was for the web front-end. For trac-admin, I get Error: Command not found
for anything beyond help
, since no commands are known.
comment:4 by , 14 years ago
follow-up: 6 comment:5 by , 14 years ago
I tried the patch from #7378 and got this error message:
Error TracError: IOError: [Errno 13] Permission denied: '/usr/www/trac/conf/trac.ini'
So I would say that it's fixed, for the case of a missing trac.ini
however the message isn't as nice:
Error TracError: AttributeError: 'Configuration' object has no attribute 'parsed_options'
comment:6 by , 14 years ago
Milestone: | → 0.13 |
---|
Replying to verm:
for the case of a missing
trac.ini
however the message isn't as nice:Error TracError: AttributeError: 'Configuration' object has no attribute 'parsed_options'
Strange, I don't see that… I will investigate (was that on Linux?)
comment:8 by , 14 years ago
In addition, we should add group rw perms to trac.ini when creating it (googlegroups:trac-users:afe74b4aa40a2d60).
comment:9 by , 14 years ago
#10098 was closed as a duplicate.
I wonder how come we get more and more of such reports lately. Has anything changed in the way we parse trac.ini
?
comment:10 by , 14 years ago
Cc: | added |
---|
comment:12 by , 13 years ago
New clue, if you're working on it. This failure is intermittent. I click the resend in firefox and it shows up … maybe yes … maybe no. Happens on any pages … login, help pages , browse source …
trac 0.12.2 ubuntu 11.04 brand new apache, all the mods and pythons …
follow-up: 15 comment:13 by , 13 years ago
When I use php5, Apache and Trac I have the same error. The error is sporadic. When disable php5, error disappears.
comment:14 by , 13 years ago
Replying to cboos:
On Windows, when the file is not readable I get the appropriate "TracError: IOError: [Errno 13] Permission denied: '…'" (trunk). However I get an "TracError: The Trac Environment needs to be upgraded." in case the trac.ini file is missing. Not good either.
I'm also getting this upgrade message when the permissions for trac.ini are incorrect:
-rw------- 1 root root 528 2011-09-17 00:19 trac.ini
Extremely confusing, and only figured out after many environment upgrade tries..
comment:15 by , 13 years ago
Replying to anonymous:
When I use php5, Apache and Trac I have the same error. The error is sporadic. When disable php5, error disappears.
I'm confirming above. My configuration: RHEL6 apache 2.2.15-5 php-5.3.2 mod_wsgi-3.2-1 postgresql 8.4.7
When Trac is served via mod_wsgi and PHP is enabled then this error appears in about 50% of requests. When I disable PHP, it works OK. Of course, disabling PHP is not acceptable solution in my case. Could someone help?
by , 13 years ago
Attachment: | t10044-configparser-read-r10853.diff added |
---|
comment:16 by , 13 years ago
Cc: | added |
---|
I can reproduce the issue:
- Create tracenv with other than sqlite database (e.g. specifies
mysql://...
) - Drop all permissions of
conf/trac.ini
. (chmod 0000 conf/trac.ini
) - Launch tracd and access using your browser.
Because Trac do not check the return value of ConfigParser.read()
and initializes self.config
with the default values in this case.
ConfigParser.read()
returns list of successfully parsed filenames. http://docs.python.org/library/configparser.html#ConfigParser.RawConfigParser.read.
In my patch, attachment:t10044-configparser-read-r10853.diff, adds checking for .read()
and handling the exception for trac-admin
.
jun66j5@gotanda:1586$ PYTHONPATH=$PWD python2.4 trac/admin/console.py ~/var/trac/0.12-t10044 Welcome to trac-admin 0.12.3dev-r0 Interactive Trac administration console. Copyright (C) 2003-2011 Edgewall Software Type: '?' or 'help' for help on commands. Trac [/home/jun66j5/var/trac/0.12-t10044]> wiki list Error: Error reading trac.ini, make sure it is readable. Trac [/home/jun66j5/var/trac/0.12-t10044]> help trac-admin - The Trac Administration Console 0.12.3dev-r0 help Show documentation initenv Create and initialize a new environment Trac [/home/jun66j5/var/trac/0.12-t10044]>
comment:17 by , 13 years ago
Looks good. You should mention the full path to the config file in the TracError
, as it's not always trac.ini
(think [inherit] file
).
You could apply this in 0.12-stable.
comment:18 by , 13 years ago
Milestone: | 0.13 → 0.12.3 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Thanks, Remy!
The patch with your suggestion is committed in [10856/branches/0.12-stable].
comment:19 by , 13 years ago
Owner: | set to |
---|
Related to #7378.