Page MenuHomePhabricator

Simultaneous edits to posts can cause an exception for the losing party
Open, LowPublicPRODUCTION ERROR

Description

Exception Caught: Flow\SubmissionHandler::commit: Expected mass rollback of all peer databases (DBO_TRX set).

{
  "_index": "logstash-2016.11.09",
  "_type": "mediawiki",
  "_id": "AVhKyhGvxgigAG7oUtaU",
  "_score": null,
  "_source": {
    "message": "Flow\\Data\\Storage\\RevisionStorage::insert\t10.68.23.30\t1062\tDuplicate entry '\\x05N\\xBD\\xE9\\xD7\\xB1>O@\\xAF\\x18' for key 'flow_revision_unique_parent' (10.68.23.30)\tINSERT  INTO `flow_revision` (rev_id,rev_user_id,rev_user_ip,rev_user_wiki,rev_parent_id,rev_change_type,rev_type,rev_type_id,rev_content,rev_flags,rev_mod_state,rev_mod_user_id,rev_mod_user_ip,rev_mod_user_wiki,rev_mod_timestamp,rev_mod_reason,rev_last_edit_id,rev_edit_user_id,rev_edit_user_ip,rev_edit_user_wiki,rev_content_length,rev_previous_content_length) VALUES ('\u0005a+(9ãî4)˜\u000f','74',NULL,'hewiki','\u0005Nœé×±>O@¯\u0018','edit-post','post','\u0005Nœé×±>O@¯\u0018','DB://flow_cluster1/35','utf-8,gzip,html,external','',NULL,NULL,NULL,NULL,NULL,'\u0005a+(9ãî4)˜\u000f','74',NULL,'hewiki','26','11')",
    "@version": 1,
    "@timestamp": "2016-11-09T20:31:45.000Z",
    "type": "mediawiki",
    "host": "deployment-mediawiki05",
    "level": "ERROR",
    "tags": [
      "syslog",
      "es",
      "es"
    ],
    "channel": "DBQuery",
    "normalized_message": "{fname}\t{db_server}\t{errno}\t{error}\t{sql1line}",
    "url": "/w/api.php",
    "ip": "10.68.18.103",
    "http_method": "POST",
    "server": "he.wikipedia.beta.wmflabs.org",
    "referrer": "https://he.wikipedia.beta.wmflabs.org/wiki/%D7%A0%D7%95%D7%A9%D7%90:Sgbtimu66bgphlaw",
    "unique_id": "WCOHsQpEFhUAACvODzUAAAAK",
    "wiki": "hewiki",
    "mwversion": "1.29.0-alpha",
    "reqId": "WCOHsQpEFhUAACvODzUAAAAK",
    "db_server": "10.68.23.30",
    "db_name": "hewiki",
    "db_user": "wikiadmin",
    "method": "Database::reportQueryError",
    "errno": 1062,
    "error": "Duplicate entry '\\x05N\\xBD\\xE9\\xD7\\xB1>O@\\xAF\\x18' for key 'flow_revision_unique_parent' (10.68.23.30)",
    "sql1line": "INSERT  INTO `flow_revision` (rev_id,rev_user_id,rev_user_ip,rev_user_wiki,rev_parent_id,rev_change_type,rev_type,rev_type_id,rev_content,rev_flags,rev_mod_state,rev_mod_user_id,rev_mod_user_ip,rev_mod_user_wiki,rev_mod_timestamp,rev_mod_reason,rev_last_edit_id,rev_edit_user_id,rev_edit_user_ip,rev_edit_user_wiki,rev_content_length,rev_previous_content_length) VALUES ('\u0005a+(9ãî4)˜\u000f','74',NULL,'hewiki','\u0005Nœé×±>O@¯\u0018','edit-post','post','\u0005Nœé×±>O@¯\u0018','DB://flow_cluster1/35','utf-8,gzip,html,external','',NULL,NULL,NULL,NULL,NULL,'\u0005a+(9ãî4)˜\u000f','74',NULL,'hewiki','26','11')",
    "fname": "Flow\\Data\\Storage\\RevisionStorage::insert"
  },
  "fields": {
    "@timestamp": [
      1478723505000
    ]
  },
  "highlight": {
    "unique_id": [
      "@kibana-highlighted-field@WCOHsQpEFhUAACvODzUAAAAK@/kibana-highlighted-field@"
    ],
    "reqId": [
      "@kibana-highlighted-field@WCOHsQpEFhUAACvODzUAAAAK@/kibana-highlighted-field@"
    ]
  },
  "sort": [
    1478723505000
  ]
}
SeverityAn edit will fail to save when this error occurs. AFAIK the Flow UI should offer the user the option to save their edit again, and that subsequent attempt should work. See also T139219: Flow pages: better warning info/handling for edit conflicts
Frequency (last 90 days)12
Level of effort to fixMedium
What happens if we don't fixUsers will experience frustration due to edit conflicts.

Event Timeline

Change 320842 had a related patch set uploaded (by Catrope):
Use rollbackMasterChanges instead of rollback in SubmissionHandler

https://gerrit.wikimedia.org/r/320842

Change 320842 had a related patch set uploaded (by Catrope):
Use rollbackMasterChanges instead of rollback in SubmissionHandler

https://gerrit.wikimedia.org/r/320842

This patch addresses the broken/aborted rollback, but it doesn't fix the bug as a whole. You still get an exception, but instead of the "Excepted mass rollback" one you now get a normal DB exception:

Exception Caught: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? Query: INSERT INTO `flow_revision` (rev_id,rev_user_id,rev_user_ip,rev_user_wiki,rev_parent_id,rev_change_type,rev_type,rev_type_id,rev_content,rev_flags,rev_mod_state,rev_mod_user_id,rev_mod_user_ip,rev_mod_user_wiki,rev_mod_timestamp,rev_mod_reason,rev_last_edit_id,rev_edit_user_id,rev_edit_user_ip,rev_edit_user_wiki,rev_content_length,rev_previous_content_length) VALUES ('�a@�5\\�iH��','1',NULL,'wiki','�a@\r���iH��','edit-post','post','�a?�а�iH��','
defy

','utf-8,html','',NULL,NULL,NULL,NULL,NULL,'�a@�5\\�iH��','1',NULL,'wiki','4','4') Function: Flow\Data\Storage\RevisionStorage::insert Error: 1062 Duplicate entry '\x05a@\x0D\xA4\x80\x87iH\xDD\xCD' for key 'flow_revision_unique_parent' (127.0.0.1)

Change 320842 merged by jenkins-bot:
Use rollbackMasterChanges instead of rollback in SubmissionHandler

https://gerrit.wikimedia.org/r/320842

thcipriani subscribed.

Seeing these of 1.37.0-wmf.15 happening on officewiki

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 1062: Duplicate entry '*redacted*' for key 'flow_revision_unique_parent' (db2105)
Function: Flow\Data\Storage\RevisionStorage::insert
Query: INSERT INTO `flow_revisio
exception.trace
from /srv/mediawiki/php-1.37.0-wmf.15/includes/libs/rdbms/database/Database.php(1760)
#0 /srv/mediawiki/php-1.37.0-wmf.15/includes/libs/rdbms/database/Database.php(1744): Wikimedia\Rdbms\Database->getQueryException(string, integer, string, string)
#1 /srv/mediawiki/php-1.37.0-wmf.15/includes/libs/rdbms/database/Database.php(1719): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#2 /srv/mediawiki/php-1.37.0-wmf.15/includes/libs/rdbms/database/Database.php(1283): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#3 /srv/mediawiki/php-1.37.0-wmf.15/includes/libs/rdbms/database/Database.php(2406): Wikimedia\Rdbms\Database->query(string, string, integer)
#4 /srv/mediawiki/php-1.37.0-wmf.15/includes/libs/rdbms/database/Database.php(2386): Wikimedia\Rdbms\Database->doInsert(string, array, string)
#5 /srv/mediawiki/php-1.37.0-wmf.15/extensions/Flow/includes/Data/Storage/RevisionStorage.php(392): Wikimedia\Rdbms\Database->insert(string, array, string)
#6 /srv/mediawiki/php-1.37.0-wmf.15/extensions/Flow/includes/Data/ObjectManager.php(248): Flow\Data\Storage\RevisionStorage->insert(array)
#7 /srv/mediawiki/php-1.37.0-wmf.15/extensions/Flow/includes/Data/ObjectManager.php(173): Flow\Data\ObjectManager->insert(array, array)
#8 /srv/mediawiki/php-1.37.0-wmf.15/extensions/Flow/includes/Data/ObjectManager.php(146): Flow\Data\ObjectManager->multiPut(array, array)
#9 /srv/mediawiki/php-1.37.0-wmf.15/extensions/Flow/includes/Data/ManagerGroup.php(81): Flow\Data\ObjectManager->put(Flow\Model\PostRevision, array)
#10 /srv/mediawiki/php-1.37.0-wmf.15/extensions/Flow/includes/Block/TopicBlock.php(457): Flow\Data\ManagerGroup->put(Flow\Model\PostRevision, array)
#11 /srv/mediawiki/php-1.37.0-wmf.15/extensions/Flow/includes/SubmissionHandler.php(164): Flow\Block\TopicBlock->commit()
#12 /srv/mediawiki/php-1.37.0-wmf.15/extensions/Flow/includes/WorkflowLoader.php(66): Flow\SubmissionHandler->commit(Flow\Model\Workflow, array)
#13 /srv/mediawiki/php-1.37.0-wmf.15/extensions/Flow/includes/Api/ApiFlowBasePost.php(35): Flow\WorkflowLoader->commit(array)
#14 /srv/mediawiki/php-1.37.0-wmf.15/extensions/Flow/includes/Api/ApiFlow.php(108): Flow\Api\ApiFlowBasePost->execute()
#15 /srv/mediawiki/php-1.37.0-wmf.15/includes/api/ApiMain.php(1842): Flow\Api\ApiFlow->execute()
#16 /srv/mediawiki/php-1.37.0-wmf.15/includes/api/ApiMain.php(821): ApiMain->executeAction()
#17 /srv/mediawiki/php-1.37.0-wmf.15/includes/api/ApiMain.php(792): ApiMain->executeActionWithErrorHandling()
#18 /srv/mediawiki/php-1.37.0-wmf.15/api.php(90): ApiMain->execute()
#19 /srv/mediawiki/php-1.37.0-wmf.15/api.php(45): wfApiMain()
#20 /srv/mediawiki/w/api.php(3): require(string)
#21 {main}
kostajh updated the task description. (Show Details)
kostajh changed the subtype of this task from "Task" to "Production Error".
kostajh moved this task from Inbox to Triaged on the Growth-Team board.