Modify

Opened 11 years ago

Last modified 4 years ago

#11075 new defect

Failure to update multiple dependencies: IntegrityError: columns ticket, time, field are not unique

Reported by: DaveB Owned by: Ryan J Ollos
Priority: normal Component: MasterTicketsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

Changing a ticket x from

  • Blocked by: a
  • Blocking: b,c,d,e,f

to

  • Blocked by: a,b,c,d,e,f
  • Blocking:

...doesn't work cleanly.

While blocked-by/blocking fields on x were successfully changed, none of the blocked-by/blocking tickets or depgraph were updated, and it gave this error:

Trac detected an internal error:

IntegrityError: columns ticket, time, field are not unique
Python Traceback
Most recent call last:

File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 511, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 237, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.7/dist-packages/trac/ticket/web_ui.py", line 169, in process_request
  return self._process_ticket_request(req)
File "/usr/lib/python2.7/dist-packages/trac/ticket/web_ui.py", line 541, in _process_ticket_request
  self._do_save(req, ticket, action)
File "/usr/lib/python2.7/dist-packages/trac/ticket/web_ui.py", line 1238, in _do_save
  cnum=internal_cnum):
File "/usr/lib/python2.7/dist-packages/trac/ticket/model.py", line 360, in save_changes
  listener.ticket_changed(self, comment, author, old_values)
File "/usr/lib/python2.7/dist-packages/mastertickets/api.py", line 111, in ticket_changed
  links.save(author, comment, tkt.time_changed, db)
File "/usr/lib/python2.7/dist-packages/mastertickets/model.py", line 76, in save
  (n, when_ts, author, 'comment', '', '(In #%s) %s'%(self.tkt.id, comment)))
File "/usr/lib/python2.7/dist-packages/trac/db/util.py", line 65, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/lib/python2.7/dist-packages/trac/db/sqlite_backend.py", line 78, in execute
  result = PyFormatCursor.execute(self, *args)
File "/usr/lib/python2.7/dist-packages/trac/db/sqlite_backend.py", line 56, in execute
  args or [])
File "/usr/lib/python2.7/dist-packages/trac/db/sqlite_backend.py", line 48, in _rollback_on_error
  return function(self, *args, **kwargs)

Changing a ticket blocked-by/blocking x (to tidy up afterwards) was succesful except for not updating the depgraph, and this error (maybe related to #8792):

Trac detected an internal error:

ValueError: list.remove(x): x not in list
Python Traceback
Most recent call last:

File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 511, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 237, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.7/dist-packages/trac/ticket/web_ui.py", line 169, in process_request
  return self._process_ticket_request(req)
File "/usr/lib/python2.7/dist-packages/trac/ticket/web_ui.py", line 541, in _process_ticket_request
  self._do_save(req, ticket, action)
File "/usr/lib/python2.7/dist-packages/trac/ticket/web_ui.py", line 1238, in _do_save
  cnum=internal_cnum):
File "/usr/lib/python2.7/dist-packages/trac/ticket/model.py", line 360, in save_changes
  listener.ticket_changed(self, comment, author, old_values)
File "/usr/lib/python2.7/dist-packages/mastertickets/api.py", line 111, in ticket_changed
  links.save(author, comment, tkt.time_changed, db)
File "/usr/lib/python2.7/dist-packages/mastertickets/model.py", line 68, in save
  update_field(new_value)
File "/usr/lib/python2.7/dist-packages/mastertickets/model.py", line 61, in <lambda>
  update_field = lambda lst: lst.remove(str(self.tkt.id))

System Information:

Trac 	0.12.2
Babel 	0.9.6 (translations unavailable)
Docutils 	0.8.1
Genshi 	0.6
GIT 	1.7.9.5
mod_wsgi 	3.3 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
Pygments 	1.4
pysqlite 	2.6.0
Python 	2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3]
pytz 	2011k
RPC 	1.1.2
setuptools 	0.6
SQLite 	3.7.9
Subversion 	1.6.17 (r1128011)
Enabled Plugins:
graphviz 	0.7.5 	/usr/lib/pymodules/python2.7
TracGit 	0.12.0.5dev 	/usr/lib/python2.7/dist-packages
TracMasterTickets 	3.0.2 	/usr/lib/python2.7/dist-packages
TracXMLRPC 	1.1.2 	/usr/lib/python2.7/dist-packages

Attachments (0)

Change History (6)

comment:1 Changed 11 years ago by Ryan J Ollos

Trac Release: 0.12

The first issue is a possible duplicate of #10194, and possibly fixed in [12936].

Please update MasterTicketsPlugin to the latest version 3.0.5, and report back if you are able to reproduce with the latest version. I'm less optimistic that the second issue you reported is fixed already, but I'll get a fix in place quickly if you can offer some testing and follow-up.

Unfortunately this plugin is a bit of a disaster. It should never be possible to end up with the database in an inconsistent state like you describe, however this can happen rather easily because of how the link relations are stored and because there are multiple database transactions for a single change to a ticket. I've tried to fix it up lately, but it is not up to par yet. I just wanted to warn you.

comment:2 Changed 11 years ago by Ryan J Ollos

Keywords: needinfo added

comment:3 Changed 11 years ago by DaveB

Took me a while (and reading those mentioned tickets) to reproduce, so I can test the upgrade fixes it. I found that the bug is only triggered if a comment is included when changing the dependencies.

I've built the new version, but I'm just trying to figure out how best way to put it in place (as I'm currently using a package from my distro's repository.

Hopefully it won't take me long to upgrade and report back...

comment:4 Changed 11 years ago by DaveB

3.0.5dev doesn't seem to have fixed it, unfortunately - unless there's some Python clear cache I need to do?..

The error has changed slightly:

IntegrityError: columns ticket, time, field are not unique
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 511, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 237, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.7/dist-packages/trac/ticket/web_ui.py", line 169, in process_request
  return self._process_ticket_request(req)
File "/usr/lib/python2.7/dist-packages/trac/ticket/web_ui.py", line 541, in _process_ticket_request
  self._do_save(req, ticket, action)
File "/usr/lib/python2.7/dist-packages/trac/ticket/web_ui.py", line 1238, in _do_save
  cnum=internal_cnum):
File "/usr/lib/python2.7/dist-packages/trac/ticket/model.py", line 360, in save_changes
  listener.ticket_changed(self, comment, author, old_values)
File "/usr/lib/python2.7/dist-packages/mastertickets/api.py", line 111, in ticket_changedFile "/usr/lib/python2.7/dist-packages/mastertickets/model.py", line 76, in save
  new_value = [x.strip() for x in old_value.split(',') if x.strip()]
File "/usr/lib/python2.7/dist-packages/trac/db/util.py", line 65, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/lib/python2.7/dist-packages/trac/db/sqlite_backend.py", line 78, in execute
  result = PyFormatCursor.execute(self, *args)
File "/usr/lib/python2.7/dist-packages/trac/db/sqlite_backend.py", line 56, in execute
  args or [])
File "/usr/lib/python2.7/dist-packages/trac/db/sqlite_backend.py", line 48, in _rollback_on_error
  return function(self, *args, **kwargs)

System Information (slightly different, as it's a test installation):

Trac 	0.12.2
Babel 	0.9.6 (translations unavailable)
Docutils 	0.8.1
Genshi 	0.6
mod_wsgi 	3.3 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
Pygments 	1.4
pysqlite 	2.6.0
Python 	2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3]
pytz 	2011k
setuptools 	0.6
SQLite 	3.7.9
Subversion 	1.6.17 (r1128011)

graphviz 	0.7.5 	/usr/lib/pymodules/python2.7
TracMasterTickets 	3.0.5dev 	/usr/lib/python2.7/dist-packages

comment:5 Changed 11 years ago by Ryan J Ollos

Keywords: needinfo removed
Status: newassigned

comment:6 Changed 4 years ago by Ryan J Ollos

Status: assignednew

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Ryan J Ollos.

Add Comment


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

 
Note: See TracTickets for help on using tickets.