Bug:EntryResource:linkBranch timeouts due to branch scanner transaction length
Bug #816235 reported by
Robert Collins
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
Critical
|
Unassigned |
Bug Description
1 INSERT INTO BugBranch (branch, bug, datecreated, revision_hint, registrant) VALUES ($INT, $INT, CURRENT_TIMESTAMP AT TIME ZONE $STRING, None, $INT) RETURNING BugBranch.id:
POST: 1 Robots: 0 Local: 1
1 https:/
OOPS-2032F24
32. 128 8970ms SQL-launchpad-
INSERT INTO BugBranch (branch, bug, datecreated, revision_hint, registrant)
VALUES (501845, 721166, CURRENT_TIMESTAMP AT TIME ZONE 'UTC', NONE, 67034) RETURNING BugBranch.id
This behaviour - a very long trivial insert - will occur when two transactions attempt to do something that violates a unique constraint at the same time.
e.g. in launchpad_dev, do this in two sessions:
begin;
INSERT INTO BugBranch (branch, bug, datecreated, revision_hint, registrant) VALUES (76, 13, CURRENT_TIMESTAMP AT TIME ZONE 'UTC', NULL, 2) RETURNING BugBranch.id;
observe that the second one will block until the first transaction completes; at which point it will either raise a duplicate key error or complete itself.
Whats odd though, if that is whats happening here, is that the first page reaching the insert must have been ultra-slow for (presumably some other reason).
We probably want some log analysis to confirm this theory.