Page MenuHomePhabricator

Deadlock in FlaggedRevision::insertOn on edit autoreview
Closed, ResolvedPublic

Description

A hu.wikipedia user reported an "1213: Deadlock found when trying to get lock" SQL error thrown by FlaggedRevision::insertOn when trying to save a page. The reporter is in the 'trusted' group (that is, he has autoreview right but not review). The page he tried to edit was in 'sighted' state.


Version: unspecified
Severity: normal

Details

Reference
bz26224

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:14 PM
bzimport set Reference to bz26224.
bzimport added a subscriber: Unknown Object (MLST).

Does this happen often? Things like that will happen from rarely, but not never, under normal cases.

We had only one report to date. Then again, it has only been a week or two since the FlaggedRevs code update, so - assuming the bug is related to that - it can't be too infrequent if it occured this soon. (At least frequent enough to merit a better error message.)

(In reply to comment #2)

We had only one report to date. Then again, it has only been a week or two
since the FlaggedRevs code update, so - assuming the bug is related to that -
it can't be too infrequent if it occured this soon. (At least frequent enough
to merit a better error message.)

Was this with the JavaScript AJAX review form? Previously, those kind of errors were simply not displayed to the user (you just get "action failed" in the title).

(In reply to comment #3)

(In reply to comment #2)

We had only one report to date. Then again, it has only been a week or two
since the FlaggedRevs code update, so - assuming the bug is related to that -
it can't be too infrequent if it occured this soon. (At least frequent enough
to merit a better error message.)

Was this with the JavaScript AJAX review form? Previously, those kind of errors
were simply not displayed to the user (you just get "action failed" in the
title).

Nevermind, this is about autoreview on edit.

I am running a script using api on dewiki this evening i'll used many times before without any problems. But i got this error three times within 10 minutes. The last one:

editing de:Izumi Sakai using api with action=edit&appendtext=...

<?xml version="1.0"?><api><error code="internal_api_error_DBQueryError" info="Database query error" xml:space="preserve">

#0 /usr/local/apache/common-local/wmf-deployment/includes/db/Database.php(541): DatabaseBase-&gt;reportQueryError('Deadlock found ...', 1213, 'INSERT IGNORE I...', 'FlaggedRevision...', false)
#1 /usr/local/apache/common-local/wmf-deployment/includes/db/Database.php(1174): DatabaseBase-&gt;query('INSERT IGNORE I...', 'FlaggedRevision...')
#2 /usr/local/apache/common-local/wmf-deployment/extensions/FlaggedRevs/FlaggedRevision.php(324): DatabaseBase-&gt;insert('flaggedtemplate...', Array, 'FlaggedRevision...', 'IGNORE')
#3 /usr/local/apache/common-local/wmf-deployment/extensions/FlaggedRevs/FlaggedRevs.class.php(1353): FlaggedRevision-&gt;insertOn(true)
#4 /usr/local/apache/common-local/wmf-deployment/extensions/FlaggedRevs/FlaggedRevs.hooks.php(726): FlaggedRevs::autoReviewEdit(Object(Article), Object(User), Object(Revision), NULL)
#5 [internal function]: FlaggedRevsHooks::maybeMakeEditReviewed(Object(Article), Object(Revision), false, Object(User))
#6 /usr/local/apache/common-local/wmf-deployment/includes/Hooks.php(133): call_user_func_array(Array, Array)
#7 /usr/local/apache/common-local/wmf-deployment/includes/Article.php(1982): wfRunHooks('NewRevisionFrom...', Array)
#8 /usr/local/apache/common-local/wmf-deployment/includes/Article.php(1791): Article-&gt;doEdit('[[Bild:Entertai...', '+[[fi:Izumi Sak...', 102)
#9 /usr/local/apache/common-local/wmf-deployment/includes/EditPage.php(1047): Article-&gt;updateArticle('[[Bild:Entertai...', '+[[fi:Izumi Sak...', true, true, false, '')
#10 /usr/local/apache/common-local/wmf-deployment/includes/api/ApiEditPage.php(238): EditPage-&gt;internalAttemptSave(NULL, false)
#11 /usr/local/apache/common-local/wmf-deployment/includes/api/ApiMain.php(595): ApiEditPage-&gt;execute()
#12 /usr/local/apache/common-local/wmf-deployment/includes/api/ApiMain.php(338): ApiMain-&gt;executeAction()
#13 /usr/local/apache/common-local/wmf-deployment/includes/api/ApiMain.php(322): ApiMain-&gt;executeActionWithErrorHandling()
#14 /usr/local/apache/common-local/wmf-deployment/api.php(116): ApiMain-&gt;execute()
#15 /usr/local/apache/common-local/live-1.5/api.php(3): require('/usr/local/apac...')
#16 {main}

</error></api>

(In reply to comment #5)

I am running a script using api on dewiki this evening i'll used many times
before without any problems. But i got this error three times within 10
minutes.

How are you using the review API? It might help to know the usage patterns, though these things can be tricky to track either way.

(In reply to comment #6)

(In reply to comment #5)

I am running a script using api on dewiki this evening i'll used many times
before without any problems. But i got this error three times within 10
minutes.

How are you using the review API? It might help to know the usage patterns,
though these things can be tricky to track either way.

Bitten again...edit API, not review. At least that narrows it down to autoReviewEdit() function area.

Tweaked the insertOn() function to be less deadlock prone in r78052. Synced. I'll wait to see if other tweaks are needed.

Is this still occurring often?

Marking closed. r78052 should reduce this, and I haven't heard of new reports (this kind of thing isn't a problem unless it is frequent).

Folding into (a bit) more general bug 28598.

*** This bug has been marked as a duplicate of bug 28598 ***