Modify ↓
Opened 10 years ago
Closed 10 years ago
#12263 closed defect (fixed)
IntegrityError: duplicate key value violates unique constraint "ticket_change_pk"
| Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.0.10 |
| Component: | ticket system | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: |
Prevent multiple form submits for the Submit changes button on the ticket edit comment page. |
||
| API Changes: | |||
| Internal Changes: | |||
Description
While editing a comment on trac-hacks.org yesterday I saw this error. It might have been due to a double-submit, but didn't we already fix that issue in #10138? I'll have to refresh my memory on that.
2015-12-02 17:07:48,264 Trac[main] ERROR: Internal Server Error: <RequestWithSession "POST '/ticket/12588'">, referrer 'https://trac-hacks.org/ticket/12588?cnum_edit=8'
Traceback (most recent call last):
File "build/bdist.linux-i686/egg/trac/web/main.py", line 554, in _dispatch_request
dispatcher.dispatch(req)
File "build/bdist.linux-i686/egg/trac/web/main.py", line 247, in dispatch
resp = chosen_handler.process_request(req)
File "build/bdist.linux-i686/egg/trac/ticket/web_ui.py", line 182, in process_request
return self._process_ticket_request(req)
File "build/bdist.linux-i686/egg/trac/ticket/web_ui.py", line 578, in _process_ticket_request
ticket.modify_comment(change['date'], req.authname, comment)
File "build/bdist.linux-i686/egg/trac/ticket/model.py", line 560, in modify_comment
old_comment or '', str(when_ts)))
File "build/bdist.linux-i686/egg/trac/db/util.py", line 128, in execute
cursor.execute(query, params if params is not None else [])
File "build/bdist.linux-i686/egg/trac/db/util.py", line 72, in execute
return self.cursor.execute(sql_escape_percent(sql), args)
IntegrityError: duplicate key value violates unique constraint "ticket_change_pk"
IntegrityError: duplicate key value violates unique constraint "ticket_change_pk"
Attachments (0)
Change History (2)
comment:1 by , 10 years ago
| Owner: | set to |
|---|---|
| Release Notes: | modified (diff) |
| Status: | new → assigned |
comment:2 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.



I haven't been able to reproduce with SQLite. The backend in which the issue was seen is PostgeSQL.
The duplicate key violation must have been due to a duplicate
fieldvalue (e.g._comment1). I could only see that happening due to a second submit before the database transaction of the first submit has been committed. Therefore I'll add thetrac-disable-on-submitclass to the submit button (#10138).