Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12191 closed defect (fixed)

IntegrityError: duplicate key value violates unique constraint "report_pkey" DETAIL: Key (id)=(10) already exists.

Reported by: massimo.b@… Owned by: Russ Tyndall
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

Coming from http://trac.edgewall.org/ticket/11958

I have this issue, when I try to save a new ticket query. This is a fresh 1.0.3 installation with Postgres, never migrated that database.

The issue is reproducible on a separate test project using the same plugins and configuration. Attached you find the configuration.

Most recent call last:

File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 513, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 222, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib64/python2.7/site-packages/trac/ticket/report.py", line 163, in process_request
  self._do_create(req)
File "/usr/lib64/python2.7/site-packages/trac/ticket/report.py", line 226, in _do_create
  """, (title, query, description))
File "/usr/lib64/python2.7/site-packages/trac/db/util.py", line 72, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)

The query expression:

query:?status=accepted
&
status=assigned
&
status=new
&
status=reopened
&
component=GUI
&
col=id
&
col=summary
&
col=component
&
col=status
&
col=owner
&
col=type
&
col=priority
&
col=milestone
&
col=time
&
col=reporter
&
order=priority
System Information:

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0
Trac 	1.0.4
Docutils 	0.12
FullBlog 	0.1.1-r0
Genshi 	0.7 (with speedups)
GIT 	2.0.5
psycopg2 	2.5.3
Pygments 	2.0predev-20150123
Python 	2.7.9 (default, Jan 23 2015, 15:27:02) [GCC 4.8.3]
pytz 	2014.10
setuptools 	7.0
jQuery	1.7.2
jQuery UI	1.8.21
jQuery Timepicker	1.0.1
Enabled Plugins:
acct-mgr.admin 	N/A 	/usr/lib64/python2.7/site-packages/acct_mgr/admin.pyc
acct-mgr.api 	N/A 	/usr/lib64/python2.7/site-packages/acct_mgr/api.pyc
acct-mgr.db 	N/A 	/usr/lib64/python2.7/site-packages/acct_mgr/db.pyc
acct-mgr.htfile 	N/A 	/usr/lib64/python2.7/site-packages/acct_mgr/htfile.pyc
acct-mgr.http 	N/A 	/usr/lib64/python2.7/site-packages/acct_mgr/http.pyc
acct-mgr.macros 	N/A 	/usr/lib64/python2.7/site-packages/acct_mgr/macros.pyc
acct-mgr.notification 	N/A 	/usr/lib64/python2.7/site-packages/acct_mgr/notification.pyc
acct-mgr.pwhash 	N/A 	/usr/lib64/python2.7/site-packages/acct_mgr/pwhash.pyc
acct-mgr.register 	N/A 	/usr/lib64/python2.7/site-packages/acct_mgr/register.pyc
acct-mgr.svnserve 	N/A 	/usr/lib64/python2.7/site-packages/acct_mgr/svnserve.pyc
acct-mgr.web-ui 	N/A 	/usr/lib64/python2.7/site-packages/acct_mgr/web_ui.pyc
RoadmapHours 	0.5 	/mnt/data/trac/projects/trac-pmp/plugins/RoadmapHours-0.5-py2.7.egg
SimpleMultiProject 	0.0.4dev-r14359 	/mnt/data/trac/projects/trac-pmp/plugins/SimpleMultiProject-0.0.4dev_r14359-py2.7.egg
timingandestimationplugin 	1.3.7 	/mnt/data/trac/projects/trac-pmp/plugins/timingandestimationplugin-1.3.7-py2.7.egg
TracAnnouncer 	1.0dev-r13984 	/mnt/data/trac/projects/trac-pmp/plugins/TracAnnouncer-1.0dev_r13984-py2.7.egg
TracAutocompleteUsersPlugin 	0.4.3dev-r14213 	/mnt/data/trac/projects/trac-pmp/plugins/TracAutocompleteUsersPlugin-0.4.3dev_r14213-py2.7.egg
TracDiscussion 	0.9dev-r14140 	/mnt/data/trac/projects/trac-pmp/plugins/TracDiscussion-0.9dev_r14140-py2.7.egg
TracFullBlogPlugin 	0.1.1-r0 	/mnt/data/trac/projects/trac-pmp/plugins/TracFullBlogPlugin-0.1.1_r0-py2.7.egg
TracGanttCalendarPlugin 	0.6.4-r859 	/mnt/data/trac/projects/trac-pmp/plugins/TracGanttCalendarPlugin-0.6.4_r859-py2.7.egg
TracMasterTickets 	3.0.5dev-r14323 	/mnt/data/trac/projects/trac-pmp/plugins/TracMasterTickets-3.0.5dev_r14323-py2.7.egg
TracWatchlistPlugin 	1.0.1 	/mnt/data/trac/projects/trac-pmp/plugins/TracWatchlistPlugin-1.0.1-patched_py2.7.egg
TracWorkflowAdmin 	0.12.0.2 	/mnt/data/trac/projects/trac-pmp/plugins/TracWorkflowAdmin-0.12.0.2-py2.7.egg
WikiAutoComplete 	1.0 	/mnt/data/trac/projects/trac-pmp/plugins/WikiAutoComplete-1.0-py2.7.egg
WorkLog 	0.4dev-r13835 	/mnt/data/trac/projects/trac-pmp/plugins/WorkLog-0.4dev_r13835-py2.7.egg

Attachments (1)

trac.ini (7.7 KB) - added by massimo.b@… 9 years ago.

Download all attachments as: .zip

Change History (13)

Changed 9 years ago by massimo.b@…

Attachment: trac.ini added

comment:1 Changed 9 years ago by Russ Tyndall

I am aware of this and will try to fix it shortly. In the mean time I think a work around is to keep saving till it works. The problem is that the "Serial/auto_increment" column is not updated correctly when we create the reports in the latest trac. Each insert attempts to update it by 1, so that eventually you get to where it was supposed to be. Not great, but at least should allow you to work around it.

see also: #12010

comment:2 Changed 9 years ago by massimo.b@…

The proposed bugfix in the downstream bugreport by jomae and fixing the database works. Now I'm able to store custom queries. Would that bugfix be appropriate or only a work-around?

BTW, as TimingAndEstimationPlugin currently is only nice-to-have but not required nor used I tried to remove the timingandestimationplugin-1.4.4b-py2.7.egg completely, but that is breaking Trac:

Cannot find implementation(s) of the IPermissionPolicy interface named InternalTicketsPolicy. Please check that the Component is enabled or update the option [trac] permission_policies in trac.ini.

How can I fix that for disabling the plugin for a while?

comment:3 Changed 9 years ago by massimo.b@…

Next encountered issue, when using the CSV exporter:

Trac detected an internal error:

UnboundLocalError: local variable 'col' referenced before assignment

Python Traceback
Most recent call last:

    File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 513, in _dispatch_request
    File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 222, in dispatch
    File "/usr/lib64/python2.7/site-packages/trac/ticket/query.py", line 980, in process_request
    File "/usr/lib64/python2.7/site-packages/trac/mimeview/api.py", line 1030, in send_converted
    File "/usr/lib64/python2.7/site-packages/trac/mimeview/api.py", line 705, in convert_content
    File "/usr/lib64/python2.7/site-packages/trac/ticket/query.py", line 873, in convert_content
    File "build/bdist.linux-x86_64/egg/timingandestimationplugin/tande_filters.py", line 53, in new_csv_export

Is that related here or some new issue?

comment:4 Changed 9 years ago by Russ Tyndall

In 14424:

fix bad variable reference in csv export filters re #12191

comment:5 in reply to:  2 Changed 9 years ago by Russ Tyndall

Replying to massimo.b@…:

The proposed bugfix in the downstream bugreport by jomae and fixing the database works. Now I'm able to store custom queries. Would that bugfix be appropriate or only a work-around?

That only works on postgres and trac runs on sqlite, mysql, and postgres, so I need to work out a better solution.

BTW, as TimingAndEstimationPlugin currently is only nice-to-have but not required nor used I tried to remove the timingandestimationplugin-1.4.4b-py2.7.egg completely, but that is breaking Trac:

Cannot find implementation(s) of the IPermissionPolicy interface named InternalTicketsPolicy. Please check that the Component is enabled or update the option [trac] permission_policies in trac.ini.

How can I fix that for disabling the plugin for a while?

You simply need to remove the InternalTicketsPolicy from the [trac] permission_policies option in your trac ini file.

As far as csv stuff goes, I think I put a patch in place that will fix it (1.4.5b).

Cheers and thanks for filing bug reports, it is an boon to the community.

comment:6 in reply to:  2 ; Changed 9 years ago by Ryan J Ollos

Replying to massimo.b@…:

BTW, as TimingAndEstimationPlugin currently is only nice-to-have but not required nor used I tried to remove the timingandestimationplugin-1.4.4b-py2.7.egg completely, but that is breaking Trac:

Cannot find implementation(s) of the IPermissionPolicy interface named InternalTicketsPolicy. Please check that the Component is enabled or update the option [trac] permission_policies in trac.ini.

How can I fix that for disabling the plugin for a while?

I've really tried to make that error message clear, but users seem to completely ignore it. The solution, as bobbysmith007 has said, is described in the message: ... update the option [trac] permission_policies in trac.ini. How could it be made more clear? That's a serious question, not sarcastic statement.

comment:7 in reply to:  6 ; Changed 9 years ago by Russ Tyndall

Replying to rjollos:

Replying to massimo.b@…:

BTW, as TimingAndEstimationPlugin currently is only nice-to-have but not required nor used I tried to remove the timingandestimationplugin-1.4.4b-py2.7.egg completely, but that is breaking Trac:

Cannot find implementation(s) of the IPermissionPolicy interface named InternalTicketsPolicy. Please check that the Component is enabled or update the option [trac] permission_policies in trac.ini.

How can I fix that for disabling the plugin for a while?

I've really tried to make that error message clear, but users seem to completely ignore it. The solution, as bobbysmith007 has said, is described in the message: ... update the option [trac] permission_policies in trac.ini. How could it be made more clear? That's a serious question, not sarcastic statement.

The error message seems clear, but perhaps the issue is that, the user is not actively editing the trac.ini to create the option (happens as part of install) so they are unaware of the conf file or this particular change.

I nice solution might be to simply log the error and skip loading the missing component. I feel like there are probably unpredictable implications of such a strategy though :/

The uninstall script for this plugin also asks the user to "Please remove InternalTicketsPolicy from your trac.ini [trac] permission_policies", so if there is better verbiage, I will update that message too.

comment:8 in reply to:  7 Changed 9 years ago by Ryan J Ollos

Replying to bobbysmith007:

I nice solution might be to simply log the error and skip loading the missing component. I feel like there are probably unpredictable implications of such a strategy though :/

Loading of the component is enforced since trac:milestone:1.0.2 to resolve a security hole: trac:#10285.

Last edited 9 years ago by Ryan J Ollos (previous) (diff)

comment:9 in reply to:  6 Changed 9 years ago by massimo.b@…

Replying to rjollos:

Cannot find implementation(s) of the IPermissionPolicy interface named InternalTicketsPolicy. Please check that the Component is enabled or update the option [trac] permission_policies in trac.ini.

I've really tried to make that error message clear, but users seem to completely ignore it. The solution, as bobbysmith007 has said, is described in the message: ... update the option [trac] permission_policies in trac.ini. How could it be made more clear? That's a serious question, not sarcastic statement.

I just got involved now in the permission_policies and what it means to implement IPermissionPolicy. This is a coding detail. For the user or even admin of a trac this would sound more familar:

Permission policy "InternalTicketsPolicy" not found, please update permission_policies in the [trac] section of your trac.ini.

Then I could imagine that InternalTicketsPolicy is something missing because I removed TimingAndEstimationPlugin. However http://trac-hacks.org/wiki/TimingAndEstimationPlugin does not mention it and the manual only has it in some example without a note.

comment:10 Changed 9 years ago by Russ Tyndall

Resolution: fixed
Status: newclosed

In 14426:

fixing report Primary Key bugs 1.4.6 fix #12010 fix #12191

comment:11 Changed 9 years ago by massimo.b@…

Thanks. Do I need any database fixes after these bugfixes?

comment:12 Changed 9 years ago by Russ Tyndall

Thanks. Do I need any database fixes after these bugfixes?

If the sequences are still broken, then yes, but you can either keep saving till it works (about 8-10 times) or run the sequence update from #12010. I thought I saw above that you had already run that though, so I think that you should be good.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Russ Tyndall.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.