Edgewall Software
Modify

Opened 9 years ago

Closed 9 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 Ryan J Ollos, 9 years ago

Owner: set to Ryan J Ollos
Release Notes: modified (diff)
Status: newassigned

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 field value (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 the trac-disable-on-submit class to the submit button (#10138).

comment:2 by Ryan J Ollos, 9 years ago

Resolution: fixed
Status: assignedclosed

Committed to 1.0-stable in [14373], merged to trunk in [14374].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.