Modify

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#8002 closed defect (fixed)

TracError

Reported by: anonymous Owned by: bobbysmith007
Priority: high Component: TimingAndEstimationPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.12

Description

After installing the plugin I get the following error:

Traceback (most recent call last):
  File "build/bdist.linux-i686/egg/trac/web/api.py", line 436, in send_error
    data, 'text/html')
  File "build/bdist.linux-i686/egg/trac/web/chrome.py", line 827, in render_template
    message = req.session.pop('chrome.%s.%d' % (type_, i))
  File "build/bdist.linux-i686/egg/trac/web/api.py", line 212, in __getattr__
    value = self.callbacks[name](self)
  File "build/bdist.linux-i686/egg/trac/web/main.py", line 300, in _get_session
    return Session(self.env, req)
  File "build/bdist.linux-i686/egg/trac/web/session.py", line 167, in __init__
    self.get_session(req.authname, authenticated=True)
  File "build/bdist.linux-i686/egg/trac/web/session.py", line 183, in get_session
    super(Session, self).get_session(sid, authenticated)
  File "build/bdist.linux-i686/egg/trac/web/session.py", line 56, in get_session
    db = self.env.get_db_cnx()
  File "build/bdist.linux-i686/egg/trac/env.py", line 328, in get_db_cnx
    return get_read_db(self)
  File "build/bdist.linux-i686/egg/trac/db/api.py", line 90, in get_read_db
    return _transaction_local.db or DatabaseManager(env).get_connection()
  File "build/bdist.linux-i686/egg/trac/db/api.py", line 152, in get_connection
    return self._cnx_pool.get_cnx(self.timeout or None)
  File "build/bdist.linux-i686/egg/trac/db/pool.py", line 226, in get_cnx
    return _backend.get_cnx(self._connector, self._kwargs, timeout)
  File "build/bdist.linux-i686/egg/trac/db/pool.py", line 146, in get_cnx
    raise TimeoutError(errmsg)
TimeoutError: Unable to get database connection within 0 seconds.
TracError(<babel.support.LazyProxy object at 0xa2d2b44>,)

Any ideas?

Attachments (11)

systeminformation.rtf (7.9 KB) - added by anonymous 4 years ago.
apache conf.rtf (1.3 KB) - added by anonymous 4 years ago.
installing process.rtf (16.3 KB) - added by anonymous 4 years ago.
trac log.rtf (4.3 KB) - added by anonymous 4 years ago.
Begins before upgrading the database.
apache_conf.txt (2.5 KB) - added by anonymous 4 years ago.
installing_process.txt (15.7 KB) - added by anonymous 4 years ago.
trac_20110531.log (125.7 KB) - added by anonymous 3 years ago.
trac debug log
stack_trace_201110531.txt (2.3 KB) - added by anonymous 3 years ago.
trac_timing_plugin_enabled.zip (294.1 KB) - added by anonymous 3 years ago.
The trac env with TimingAndEstimationPlugin enabled, upgrade done
trac_without_timing_plugin_enabled_works_well.zip (234.8 KB) - added by anonymous 3 years ago.
Trac env without TimingAndEstimationPlugin enabled, works well
trac_about.zip (5.3 KB) - added by anonymous 3 years ago.
The trac about page from env trac_without_timing_plugin_enabled_works_well.zip

Download all attachments as: .zip

Change History (37)

comment:1 Changed 4 years ago by bobbysmith007

  • Can you please copy the System Information version blocks, from the about page on your trac instance?
  • What database backend are you using?
  • What version & branch of the TimingAndEstimationPlugin did you install?

None of the lines in that stack trace are about T&E, but that doesn't necessarily mean that this plugin is not involved.

Hope we can get this working for you, Russ

comment:2 Changed 4 years ago by anonymous

  • Priority changed from normal to high
  • Severity changed from normal to blocker

I've got the same error on the freshly installed trac. Backend postgresql 8.3 installed from here: http://trac-hacks.org/svn/timingandestimationplugin/branches/trac0.12

Could you resolve this problem?

comment:3 Changed 4 years ago by bobbysmith007

I am running (it seems) the same versions of trac (12.1) and T&E plugin against postgresql 8.4.

  • Can you post your trac log near where the error is occurring?
  • Are you installing against trac13dev, trac12.1, or trac12?
  • If you are installing trac from an svn checkout, can you please post the revision as well?

Once I can duplicate this error, I can start fixing it.

comment:4 Changed 4 years ago by anonymous

Hello bobbysmith007,

thanks that you want to help us with this issues.

I am a really newbie in trac! So please have some consideration. Currently I am working with a virtual machine and made some snapshots ;)

The crazy thing is, that the problem occur by using Trac with apache. If I try to use it with the standalone server, it works fine.

I attached some files to this Ticket, this could probaly helps you.

Changed 4 years ago by anonymous

Changed 4 years ago by anonymous

Changed 4 years ago by anonymous

Changed 4 years ago by anonymous

Begins before upgrading the database.

comment:5 Changed 4 years ago by bobbysmith007

Well, your system information lists you as using MySQL but you claim to be trying to use Postgres, so that could have something to do with the issue (not sure). If you are getting different results between apache and trac.d then it sounds like a config issue more than a TimingAndEstimation one, but lets see if we can get you sorted anyway.

Also please post text files instead of RTF in the future. Its not a problem, but I can view them on trac without downloading them if they are just .txt

There also seems to be a bug in the trac hacks version of trac that is preventing me from downloading files with spaces in the names, so I can only see the systeminformation file.

If what I have pointed out doesnt help you, feel free to repost each of those files and I will try to debug further.

ps. I am going on vacation for the weekend at noon EST today, so If I dont respond I will get back to you on monday next week.

Changed 4 years ago by anonymous

Changed 4 years ago by anonymous

comment:6 Changed 4 years ago by anonymous

Hello bobbysmith007,

The trac log is superfluous because is doesnt appear, if I to reach the site.

comment:7 Changed 4 years ago by spmno

Maybe your apache don't have the permission to access the directory. Try Chown?

comment:8 Changed 4 years ago by bobbysmith007

What collation are you running your database at? There are warnings in the upgrade about "Incorrect string value: '\xE2\x9C\x93..." that seem to imply it is having trouble writing utf to the database. Just a thought not sure.

I still think having the trac log would be helpful but perhaps not.

  • Why was it listing you using mysql not postgres?
  • Perhaps a trac.ini file could help?

comment:9 Changed 4 years ago by bobbysmith007

You might also want to look at using modfcgi instead of mod_python as mod_python is no longer maintained. However, I dont think this is related to your problem probably.

comment:10 Changed 4 years ago by bobbysmith007

  • Resolution set to invalid
  • Status changed from new to closed

I guess this is resolved?

Feel free to reopen if you need,

Russ

comment:11 Changed 3 years ago by diken.chen@…

  • Resolution invalid deleted
  • Status changed from closed to reopened

I got the same error after install the SubTicektPlugin. Before that it works well.

My Configuration is Ubuntu 10.04 LTS SQLite 3.6.22 Trac Plugins: TagsPlugin, AccountAdminPlugin, TracTocMacroPlugin

After manually remove this SubticketsPlugin, the issue still exists. Almost I get the stack trace as what reported in description.

Traceback (most recent call last):

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/api.py", line 440, in send_error

data, 'text/html')

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/chrome.py", line 827, in render_template

message = req.session.pop('chrome.%s.%d' % (type_, i))

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/api.py", line 216, in getattr

value = self.callbacks[name](self)

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/main.py", line 300, in _get_session

return Session(self.env, req)

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/session.py", line 192, in init

if req.authname == 'anonymous':

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/api.py", line 216, in getattr

value = self.callbacks[name](self)

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/main.py", line 159, in authenticate

authname = authenticator.authenticate(req)

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/auth.py", line 83, in authenticate

authname = self._get_name_for_cookie(req, req.incookietrac_auth?)

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/web/auth.py", line 209, in _get_name_for_cookie

db = self.env.get_db_cnx()

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/env.py", line 328, in get_db_cnx

return get_read_db(self)

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/db/api.py", line 90, in get_read_db

return _transaction_local.db or DatabaseManager(env).get_connection()

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/db/api.py", line 152, in get_connection

return self._cnx_pool.get_cnx(self.timeout or None)

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/db/pool.py", line 226, in get_cnx

return _backend.get_cnx(self._connector, self._kwargs, timeout)

File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.2-py2.6.egg/trac/db/pool.py", line 146, in get_cnx

raise TimeoutError(errmsg)

TimeoutError: Unable to get database connection within 0 seconds. (TracError(<babel.support.LazyProxy object at 0xab91a2c>,))

comment:12 Changed 3 years ago by bobbysmith007

  • Resolution set to fixed
  • Status changed from reopened to closed

As best I can tell this almost always caused by some part of the system not having permission to another part of the system. Usually the running trac process not having access to its configuration file (conf/trac.ini).

  • Does your trac log work?
    • If not it probably cannot read your trac config file telling it to log and to where.
    • If it does then can you upload the trac log where it is failing (and surrounding context).

A likely scenario for how this occurs

  • sudo Install new plugin
  • run sudo trac-admin [env] upgrade
  • trac ini file permissions are changed
  • apache user now cannot read the trac ini

If this is not the problem you are having I am not sure what else it could be you could try uploading.

I dont run SubTicketPlugin so if this bug is related to that plugin, you might actually want to open a ticket with its author, though I suspect it is permissisons/configuration.

Feel free to reopen if this doesnt solve your issue,
Russ

comment:13 Changed 3 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

Really appreciate your prompt response, Yesterday I installed this TimingAndEstimationPlugin, I met the same error. Let me answer your question one by one.

  • Does trac log works? [Answer] Yes, See the attached trac log, apache user www-data this log directory.
  • I install this plugin with easy_install with root permission
  • trac.ini does not have permission issue as I can enable the plugin via web admin
  • Apache user www-data fully own my trac deployment directory

I tested this plugin on Trac 0.12, 0.12.1, 0.12.2, Trac-0.13dev_r10708-py2.6.egg, here is a list of my available python eggs

  • Babel-0.9.5-py2.6.egg
  • configobj-4.7.2-py2.6.egg
  • Genshi-0.6-py2.6.egg
  • timingandestimationplugin-1.1.4b-py2.6.egg
  • Trac-0.12.1-py2.6.egg
  • Trac-0.12.2-py2.6.egg
  • Trac-0.12-py2.6.egg
  • Trac-0.13dev_r10708-py2.6.egg
  • TracAccountManager-0.3dev_r10176-py2.6.egg
  • TracCustomFieldAdmin-0.2.5-py2.6.egg
  • TracTags-0.7dev-py2.6.egg
  • TracTocMacro-11.0.0.3-py2.6.egg

Content of current easy-install.pth

import sys; sys.__plen = len(sys.path)
./Genshi-0.6-py2.6.egg
./TracAccountManager-0.3dev_r10176-py2.6.egg
./configobj-4.7.2-py2.6.egg
./TracTags-0.7dev-py2.6.egg
./TracTocMacro-11.0.0.3-py2.6.egg
./Babel-0.9.5-py2.6.egg
./TracCustomFieldAdmin-0.2.5-py2.6.egg
./Trac-0.12.2-py2.6.egg
./timingandestimationplugin-1.1.4b-py2.6.egg
import sys; new=sys.path[sys.__plen:];
 del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; 
sys.__egginsert = p+len(new)

When enable Trac-0.12-py2.6.egg, trac will complain cannot locate the db as I use a customized db name. After update the db path and name to default value, it continually ask me to upgrade my trac environment even after after I execute the upgrade command.

When the TimingAndEstimationPlugin work with trac 0.12.1,0.12.2 and trac 0.13dev, the error is same, see the attached stack trace.

Changed 3 years ago by anonymous

trac debug log

Changed 3 years ago by anonymous

comment:14 Changed 3 years ago by bobbysmith007

  • Please include what database backend / version you are using
  • Also what connection information you have specified in the trac.ini (you say you are using a custom database name)? (dont forget to remove the password if you post it here)
    [trac]
    #my connection string for postgre
    database = postgres://trac:{pw-here}@/trac?schema=test
    # a sample sqlite connection string
    database = sqlite:db/trac.db
    
  • The last thing I see in your trac log is that it seems to be inserting reports (during the upgrade process). Does that succeed or fail?
    • If it succeeds it seems that the trac-admin upgrade script seems to be able to connect.
    • Once you run upgrade, and you run upgrade a second time, what does it say? / can I get a log of two consecutive upgrade runs alone?
  • Do you get the "cant connect to database" when running the upgrade or only when using apache?
  • Can you connect to the database with the trac standalone server? (if you dont have this setup or whatever you can skip this. Others were able to view trac and if you can I would love to get a copy of your /about screen (when logged in as admin)) so I can see what trac thinks all the config is set to.

Sorry I cant be more helpful, but I dont experience this error, so its a bit of a crap shoot to find the bug.

Russ

comment:15 Changed 3 years ago by anonymous

Sorry for the late response. My configuration is:

  • OS: Ubuntu 10.04 LTS
  • Database: SQLite 3.6.22

I think the trac upgrade command ran successfully after I enabled the TimingAndEstimationPlugin as I did not see any error on the console when executing the upgradecommand. My previous comment "When the TimingAndEstimationPlugin work with trac 0.12.1,0.12.2 and trac 0.13dev, the error is same, see the attached stack trace." maybe make a little confuse. Here "the error is same" is not the error that trac cannot locate database but the error shown in the attached stack_trace_201110531.txt. this "cannot locate db" issue only exists on trac 0.12.

I attached 3 files. the 2 zip files are my full trac envs with files <trac_env>/conf/autz_ploicy.conf and <trac_env>/conf/trac_svn.htpassword truncated. My environment is a fresh. As requested, an about page is uploaded.

Changed 3 years ago by anonymous

The trac env with TimingAndEstimationPlugin enabled, upgrade done

Changed 3 years ago by anonymous

Trac env without TimingAndEstimationPlugin enabled, works well

Changed 3 years ago by anonymous

The trac about page from env trac_without_timing_plugin_enabled_works_well.zip

comment:16 Changed 3 years ago by bobbysmith007

You have given me a great way to debug this problem. Thanks!

I will let you know what I find once I dig through this.

Russ

comment:17 Changed 3 years ago by bobbysmith007

Well I thought you had given me a great way to debug the problem.

MY System Information after restore
Trac 	        0.12.3dev-r10639
Genshi 	        0.7dev-r1134
Pygments 	1.2.2
pysqlite 	2.4.1
Python 	        2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3]
setuptools 	0.6
SQLite 	        3.6.22
Subversion 	1.6.6 (r40053)
jQuery:	        1.4.4
YOUR Posted System Information
Trac 	 	0.12.2
Babel 	 	0.9.5
Genshi 	 	0.6
pysqlite 	2.5.5
Python 	 	2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3]
setuptools 	0.6
SQLite 	 	3.6.22
Subversion 	1.6.6 (r40053)

The restored trac environment works fine (as best I can tell) on my trac server running through apache FCGI. The differences I notice is that Babel is not currently installed on my server. I also see that I have an earlier version of pysqlite. Either of these seem like they could be a likely culprit.


Im trying to install babel now, but having never done so, things are a bit... odd

comment:18 Changed 3 years ago by bobbysmith007

I installed babel 0.9.5 successfully - I can still connect to and interact with the "broken" trac env. Looking into installing that different pysqlite now

comment:19 Changed 3 years ago by bobbysmith007

Ok, well I got pysqlite 2.5.5 installed to match your version and I am still able to run that environment.

*Sigh*, back to not knowing how to debug this problem. Perhaps you see something I am missing.

My Current System Information
Trac 	 	0.12.3dev-r10639
Babel 	 	0.9.5
Genshi 	 	0.7dev-r1134
Pygments 	1.2.2
pysqlite 	2.5.5
Python 	 	2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3]
setuptools 	0.6
SQLite 	 	3.6.22
Subversion 	1.6.6 (r40053)
jQuery:	 	1.4.4

comment:20 Changed 3 years ago by anonymous

Really appreciate your effort. The issue seems a bit weird. Did you remove your current trac by running easy_install -m trac and reinstall trac?

Seen from trac installation documentation. Trac has to be installed after install Babel. See TracInstall.

first install of the latest stable version Trac 0.12.2, with i18n support:

easy_install Babel==0.9.5
easy_install Trac
It's very important to run the two easy_install commands separately, otherwise the message catalogs won't be generated.

That's the only tricky step I can tell for now. Before I posted the issue for discussion here, I have tried many times by reinitializing my trac environment. I can reproduce this issue.

I cannot tell this is exactly an issue of the plugin as I met the same issue during installing SubTicketPlugin.

comment:21 Changed 3 years ago by bobbysmith007

I didnt use easy install, I used setup tools from svn checkouts. I did get babel and trac installed correctly with the T&E-Permissions plugin in its plugins directory. I was never able to see that error at any point.

Im not sure if it was you or a previous reporter, but they seemed to be running pretty much my exact setup, and they had the error and I didnt. Obviously there is something quite strange going on in some random software package, but its proven quite difficult to track down.

The only other thing I have been able to think of is that sqlite tends to be centered around single connection access to the database, so if some other thread / process was hung with an open connection, or one of the plugins has not switched to trac 12 database access, I could see this happening. I could also see how this would allow trac.d to work (as it is also single threaded IIRC), while leaving apache broken (which has been the case for some users).


If you su to the user running the webserver (www-data), can you connect to the database in python

import trac.env
e = trac.env.Environment('/var/trac/test')
db = e.get_read_db()
cur = db.cursor()
cur.execute("SELECT 1")
data = cur.fetchone()

comment:22 Changed 3 years ago by anonymous

Yes. It's me. I have tested this python script, it runs well with user 'www-data'.

comment:23 Changed 3 years ago by anonymous

The issue is gone after I run

chown -R www-data.www-dat /path/to/env"

Actually I had run this command when setting up my trac environment. But why it is needed to run this command again after install the TimingAndEstimationPlugin?

comment:24 Changed 3 years ago by bobbysmith007

  • Resolution set to fixed
  • Status changed from reopened to closed

Likely because some part of the upgrade changed permissions on one of the files, because it was run as a different user (db, trac.ini, etc).

Glad you got this fixed, Russ Tyndall

comment:25 follow-up: Changed 3 years ago by anonymous

I think its worth mentioning that after giving permissions Apache needs to be reloaded.

comment:26 in reply to: ↑ 25 Changed 3 years ago by bobbysmith007

Replying to anonymous:

I think its worth mentioning that after giving permissions Apache needs to be reloaded.

A good note, but this really goes without saying. After every change you make restart your apache. It will never hurt and pretty much always help.

Add Comment

Modify Ticket

Action
as closed The owner will remain bobbysmith007.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.