Opened 6 years ago

Closed 6 years ago

Work Log fails in Timeline page

Reported by: Owned by: karmadude@… coling high WorkLogPlugin critical 0.10

Description

I am getting the following error from WorkLog in the Timeline page, anyone else seen this before, and any ideas what might be causing it?

Work Log changes event provider (WorkLogTimelineAddon) failed:

AttributeError: 'Request' object has no attribute 'cursor'


comment:1 Changed 6 years ago by coling

Hmmm, odd.

Can you get a better backtrace with line numbers etc.

From what I can see it can only be the call to db.cursor(), which would imply that the db connection has failed and is somehow returning a request object???? Odd.

comment:2 Changed 6 years ago by karmadude@…

This is all I am seeing in the trac log. Is there a setting to turn on to see the backtrace?

2007-11-13 11:16:41,730 Trac[loader] DEBUG: Loading egg plugin worklog from d:\tools\python24\scripts\trac\pcg_source\plugins\worklog-0.1-py2.4.egg
2007-11-13 11:16:42,012 Trac[api] DEBUG: Updating wiki page index
2007-11-13 11:16:42,153 Trac[main] WARNING: 500 Internal Error (Work Log changes  event provider (<tt>WorkLogTimelineAddon</tt>) failed:<br /><br />AttributeError: 'Request' object has no attribute 'cursor'<p>You may want to see the other kind of events from the <a href="/trac/timeline?ticket=on&amp;milestone=on&amp;changeset=on&amp;wiki=on">Timeline</a></p>)
2007-11-13 11:16:42,246 Trac[api] DEBUG: Updating wiki page index
2007-11-13 11:16:42,339 Trac[main] WARNING: 500 Internal Error (Work Log changes  event provider (<tt>WorkLogTimelineAddon</tt>) failed:<br /><br />AttributeError: 'Request' object has no attribute 'cursor'<p>You may want to see the other kind of events from the <a href="/trac/timeline?ticket=on&amp;milestone=on&amp;changeset=on&amp;wiki=on">Timeline</a></p>)


comment:3 Changed 6 years ago by adrian@…

Same error, different message:

• When I enable all less worklog.api.worklogsetupparticipant (= disabled), then:
• I have a link through ">Admin >Tickets >Work Log" and I'm able to change configuration parameters;
• Nothing changes on tickets
• at >Timeline I have the following message "Work Log changes event provider (WorkLogTimelineAddon) failed: DatabaseError: no such table: work_log" when I've selected "Work Log changes" view
• When I enable all WorkLog components I have an "500 Internal Server Error"
• Here follows debug info
[root@XXX trac]# trac-admin /XXXX/trac/PPPPP upgrade
10:39:07 Trac[env] WARNING: Component <worklog.api.WorkLogSetupParticipant object at 0xb78da38c> re quires environment upgrade
Creating work_log table
Updating work_log table (v2)
10:39:07 Trac[api] ERROR: WorklogPlugin Exception: near "ADD": syntax error
[root@anchova trac]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: [Fri Dec 28 10:40:21 2007] [warn] module python_module is already loaded, skipping
[  OK  ]
[root@XXX trac]#

• To make the environment work again I just have to disable "worklog.api.worklogsetupparticipant" at 'trac.ini' file
• I've got this (just last 2 lines from upgrade process):
11:25:50 Trac[loader] DEBUG: Loading egg plugin wikinotification from /usr/lib/python2.4/site-packages/TracWikiNotification-0.1.0rc4-py2.4.egg
Database is up to date, no upgrade necessary.


comment:4 Changed 6 years ago by adrian@…

One more info. At the time I create e ticket Trac gives an error about the inexistence of work_log table

  File "/usr/src/build/539311-i386/install//usr/lib/python2.4/site-packages/sqlite/main.py", line 255, in execute
DatabaseError: no such table: work_log


comment:5 Changed 6 years ago by coling

Yeah but disabling the worklog.api.worklogsetupparticipant you disable the bit that (attempts) to make sure all the necessary tables etc. are created.

Are you using the 0.10 or 0.11 version? And which db backend are you using? I've tested this with SQLite and AFAIK the syntax looks good for MySQL so I'm guessing I've messed up somewhere with pgsql? If you could take a look at worklogplugin/0.11/worklog/api.py@#L74 and the two SQL commands there and try them out manually on your DB and let me know the error message that comes back, that would be great. It could be that e.g. pgsql requires the transaction for create table to be committed prior to altering it and hence why this has failed. If this is the case you may get success by changing worklogplugin/0.11/worklog/api.py@#L31 to have a version of 1 and commenting out the second batch of SQL upgrades; installing and upgrading; revert to the original; then install and upgrade again. That would work around things. But please report back all the same so I can fix properly.

comment:6 Changed 6 years ago by adrian@…

• Trac 0.10.3
• DB = SQLite
• Steps:
1. Create "work_log" Table
1. api.py@#L31 -> self.db_version = 1 #was2
2. commented -> L85 to L88
3. New Egg, Install, enabled WorkLoad, restart http server
• Results:
• Success: table created ("Creating work_log table")
• Error: "Work Log changes event provider (WorkLogTimelineAddon) failed: DatabaseError: no such column: comment" when trying to activate "Work Log changes" option at >Timeline view.
1. added L85 to L88 (but still keeped L31 = 1)
2. New Egg, Install, enabled WorkLoad, restart http server
• Error when trying to see ticket individually
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 387, in dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 208, in dispatch
chrome.populate_hdf(req, chosen_handler)
File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 319, in populate_hdf
for category, name, text in contributor.get_navigation_items(req):
File "build/bdist.linux-i686/egg/worklog/uihooks_ticket.py", line 162, in get_navigation_items
File "build/bdist.linux-i686/egg/worklog/manager.py", line 266, in get_active_task
File "build/bdist.linux-i686/egg/worklog/manager.py", line 250, in get_latest_task
File "/usr/lib/python2.4/site-packages/trac/db/util.py", line 50, in execute
return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/src/build/539311-i386/install//usr/lib/python2.4/site-packages/sqlite/main.py", line 255, in execute
DatabaseError: no such column: wl.comment

• Error when trying to create a ticket (even with error message a ticket is created)
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 387, in dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 208, in dispatch
chrome.populate_hdf(req, chosen_handler)
File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 319, in populate_hdf
for category, name, text in contributor.get_navigation_items(req):
File "build/bdist.linux-i686/egg/worklog/uihooks_ticket.py", line 162, in get_navigation_items
File "build/bdist.linux-i686/egg/worklog/manager.py", line 266, in get_active_task
File "build/bdist.linux-i686/egg/worklog/manager.py", line 250, in get_latest_task
File "/usr/lib/python2.4/site-packages/trac/db/util.py", line 50, in execute
return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/src/build/539311-i386/install//usr/lib/python2.4/site-packages/sqlite/main.py", line 255, in execute
DatabaseError: no such column: wl.comment

3. L31 back to 'self.db_version = 2'
2. Error: "500 Internal Server Error"

comment:7 follow-up: ↓ 8 Changed 6 years ago by coling

I did not expect things to work after A on it's own. You have to do A then C. C is the correct approach (e.g. fully revert to original) but you'll have to run the upgrade again (it detects that the installed version is 1 but the current version is 2 so requires a further upgrade).

Once you've done the upgrade again things should work. I'll do some work to make sure that it works with a fresh install. I guess SQLite doesn't let you change a table that's been created in the same transaction without a commit :s

comment:8 in reply to: ↑ 7 Changed 6 years ago by adrian@…

Just to give you a feedback: we now upgraded to 0.11 and PG as DB. Then I'll not be able to test this on previous environment because both production and test are on 0.11. We'll do some effort later to test on 0.11.

comment:9 Changed 6 years ago by coling

(In [3062]) Update to work with latest Trac SVN (6396). Refs #2174.

comment:10 Changed 6 years ago by akaihola

I had this issue, but after upgrading the WorkLogPlugin to current trunk and upgrading the trac database everything has been ok. This is Trac 0.11b1. If it helps anyone I can try to track down the revision number before and after the upgrade.

comment:11 Changed 6 years ago by coling

There were also some general fixes for PG db recently so if that's involved then as per comment:8 then hopefully it's all good now :)

comment:12 Changed 6 years ago by coling

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

I'm going to close this bug as I'm not supporting 0.10 anymore. If this is really really important to you, let me know and I'll maybe be convinced to look at it (will require me to setup a 0.10 env....) If patches are provided for 0.10 that fix things I'll happily commit them :)

Things seem to work OK on 0.11 for me just now.

comment:13 Changed 6 years ago by jonathan.steffan@…

• Resolution worksforme deleted
• Status changed from closed to reopened

A simple patch fixes this issue.

Changed 6 years ago by jonathan.steffan@…

Patch to fix #2174

comment:14 Changed 6 years ago by coling

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

(In [3567]) Blindly apply 0.10 patch from Jonathan Steffan. I've not tested this as I don't really have a 0.10 env to play with any more.... Thanks Jonathan :) Closes #2174

Modify Ticket

Change Properties