BUG: RT race condition

I don’t know how this happened but 2 of my users did
a “Take” on the same ticket at the same time and both
were able to take the ticket.

How can this happen?

mysql> select
id,ObjectType,ObjectId,Type,Field,OldValue,NewValue,Creator,Created from Transactions where ObjectId=103886;
| id | ObjectType | ObjectId | Type | Field | OldValue | NewValue | Creator | Created |
| 47759 | RT::Ticket | 103886 | Create | NULL | NULL | NULL | 2012 | 2007-01-16 04:26:31 |
| 47760 | RT::Ticket | 103886 | EmailRecord | NULL | NULL | NULL | 1 | 2007-01-16 04:26:32 |
| 47761 | RT::Ticket | 103886 | CustomField | 9 | NULL | NULL | 1 | 2007-01-16 04:26:32 |
| 47762 | RT::Ticket | 103886 | AddWatcher | AdminCc | NULL | 3883 | 1 | 2007-01-16 04:26:32 |
| 84725 | RT::Ticket | 103886 | Take | Owner | 10 | 334 | 334 | 2007-01-22 16:06:02 |
| 84726 | RT::Ticket | 103886 | Take | Owner | 10 | 336 | 336 | 2007-01-22 16:06:02 |
| 84739 | RT::Ticket | 103886 | CustomField | 15 | NULL | NULL | 334 | 2007-01-22 16:08:58 |
| 84754 | RT::Ticket | 103886 | Correspond | NULL | NULL | NULL | 334 | 2007-01-22 16:09:35 |
| 84755 | RT::Ticket | 103886 | Status | Status | new | open | 1 | 2007-01-22 16:09:35 |
| 84756 | RT::Ticket | 103886 | EmailRecord | NULL | NULL | NULL | 1 | 2007-01-22 16:09:36 |
| 84757 | RT::Ticket | 103886 | EmailRecord | NULL | NULL | NULL | 1 | 2007-01-22 16:09:36 |
| 84758 | RT::Ticket | 103886 | Status | Status | open | resolved | 334 | 2007-01-22 16:09:36 |
12 rows in set (0.15 sec)

I don’t know how this happened but 2 of my users did
a “Take” on the same ticket at the same time and both
were able to take the ticket.

How can this happen?

What kind of tables are you using in MySQL? Also, are you sure it
was “same time”? There’s a lot of time in one second for one
transaction to commit before another gets in.

(All of that said, this is one of the places where I think the
historical dependence on MySQL shows up: the transaction model just
isn’t that strong.)

A

Andrew Sullivan | ajs@crankycanuck.ca
The fact that technology doesn’t work is no bar to success in the marketplace.
–Philip Greenspun

We had the same issue. FWIW, I don’t really think it’s limited to
MySQL. I can’t comment on RT’s use of other databases, nor can I
comment on current RT (we’re on RT2 still). However, digging through
the RT2 code, it seemed like there wasn’t any consideration for this
possibility - there was no check to see if someone else owned the
ticket, it was just taken. I think the assumption was you wouldn’t see
the ‘TAKE’ link unless the ticket wasn’t taken. It’s been awhile since
I looked in to this, but that is my recollection.

What we did to get around this was to have the Display.html page check
the ownership of the ticket when displaying, and if it wasn’t the same
user as was logged in, we put a message at the top stating something
like “you do not own this ticket” in big red letters, just to let people
know that their ‘take’ process didn’t work as they thought.

I found the problem in RT’s code. I will be submitting a patch soon.

-Todd

We had the same issue. FWIW, I don’t really think it’s limited to
MySQL. I can’t comment on RT’s use of other databases, nor can I
comment on current RT (we’re on RT2 still). However, digging through
the RT2 code, it seemed like there wasn’t any consideration for this
possibility - there was no check to see if someone else owned the
ticket, it was just taken. I think the assumption was you wouldn’t see
the ‘TAKE’ link unless the ticket wasn’t taken. It’s been awhile since
I looked in to this, but that is my recollection.

What we did to get around this was to have the Display.html page check
the ownership of the ticket when displaying, and if it wasn’t the same
user as was logged in, we put a message at the top stating something
like “you do not own this ticket” in big red letters, just to let people
know that their ‘take’ process didn’t work as they thought.-----Original Message-----
From: rt-devel-bounces@lists.bestpractical.com
[mailto:rt-devel-bounces@lists.bestpractical.com] On Behalf Of Todd
Chapman
Sent: Monday, January 22, 2007 6:39 PM
To: rt-devel@lists.bestpractical.com
Subject: [Rt-devel] BUG: RT race condition

I don’t know how this happened but 2 of my users did
a “Take” on the same ticket at the same time and both
were able to take the ticket.

How can this happen?

mysql> select
id,ObjectType,ObjectId,Type,Field,OldValue,NewValue,Creator,Created from
Transactions where ObjectId=103886;
| id | ObjectType | ObjectId | Type | Field | OldValue |
NewValue | Creator | Created |
| 47759 | RT::Ticket | 103886 | Create | NULL | NULL |
NULL | 2012 | 2007-01-16 04:26:31 |
| 47760 | RT::Ticket | 103886 | EmailRecord | NULL | NULL |
NULL | 1 | 2007-01-16 04:26:32 |
| 47761 | RT::Ticket | 103886 | CustomField | 9 | NULL |
NULL | 1 | 2007-01-16 04:26:32 |
| 47762 | RT::Ticket | 103886 | AddWatcher | AdminCc | NULL |
3883 | 1 | 2007-01-16 04:26:32 |
| 84725 | RT::Ticket | 103886 | Take | Owner | 10 | 334
| 334 | 2007-01-22 16:06:02 |
| 84726 | RT::Ticket | 103886 | Take | Owner | 10 | 336
| 336 | 2007-01-22 16:06:02 |
| 84739 | RT::Ticket | 103886 | CustomField | 15 | NULL |
NULL | 334 | 2007-01-22 16:08:58 |
| 84754 | RT::Ticket | 103886 | Correspond | NULL | NULL |
NULL | 334 | 2007-01-22 16:09:35 |
| 84755 | RT::Ticket | 103886 | Status | Status | new |
open | 1 | 2007-01-22 16:09:35 |
| 84756 | RT::Ticket | 103886 | EmailRecord | NULL | NULL |
NULL | 1 | 2007-01-22 16:09:36 |
| 84757 | RT::Ticket | 103886 | EmailRecord | NULL | NULL |
NULL | 1 | 2007-01-22 16:09:36 |
| 84758 | RT::Ticket | 103886 | Status | Status | open |
resolved | 334 | 2007-01-22 16:09:36 |
12 rows in set (0.15 sec)

List info:
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel