Page MenuHomePhabricator

The header of User_talk:Amire80 in he.wikipedia cannot be edited
Closed, ResolvedPublic

Description

When I try to edit the header of my user talk page in Hebrew, I get:

[90401386] Database query error

2015-03-30 13:35:58 mw1136 hewiki: [90401386] /w/api.php   DBQueryError from line 1249 of /srv/mediawiki/php-1.25wmf22/includes/db/Database.php: A database error has occurred. Did you forget to run maintenance/update.php after upgrading?  See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
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 ('1��s�\'��T
                                                                                                                                                                                  ','5684',NULL,'hewiki','1�W�\"I\n:M','edit-header','header','0Ѩ@
                               ~(��','DB://cluster25/1911235','utf-8,gzip,html,external','',NULL,NULL,NULL,NULL,NULL,'1��s�\'��T
                                                                                                                                ','5684',NULL,'hewiki','363','359')
Function: Flow\Data\Storage\RevisionStorage::insert
Error: 1062 Duplicate entry '\x051\x80W\xCE"\x05I\x0A:M' for key 'flow_revision_unique_parent' (10.64.16.18)

#0 /srv/mediawiki/php-1.25wmf22/includes/db/Database.php(1205): DatabaseBase->reportQueryError()
#1 /srv/mediawiki/php-1.25wmf22/includes/db/Database.php(2090): DatabaseBase->query()
#2 /srv/mediawiki/php-1.25wmf22/extensions/Flow/includes/Data/Storage/RevisionStorage.php(394): DatabaseBase->insert()
#3 /srv/mediawiki/php-1.25wmf22/extensions/Flow/includes/Data/ObjectManager.php(242): Flow\Data\Storage\RevisionStorage->insert()
#4 /srv/mediawiki/php-1.25wmf22/extensions/Flow/includes/Data/ObjectManager.php(167): Flow\Data\ObjectManager->insert()
#5 /srv/mediawiki/php-1.25wmf22/extensions/Flow/includes/Data/ObjectManager.php(140): Flow\Data\ObjectManager->multiPut()
#6 /srv/mediawiki/php-1.25wmf22/extensions/Flow/includes/Data/ManagerGroup.php(80): Flow\Data\ObjectManager->put()
#7 /srv/mediawiki/php-1.25wmf22/extensions/Flow/includes/Block/Header.php(182): Flow\Data\ManagerGroup->put()
#8 /srv/mediawiki/php-1.25wmf22/extensions/Flow/includes/SubmissionHandler.php(128): Flow\Block\HeaderBlock->commit()
#9 /srv/mediawiki/php-1.25wmf22/extensions/Flow/includes/WorkflowLoader.php(66): Flow\SubmissionHandler->commit()
#10 /srv/mediawiki/php-1.25wmf22/extensions/Flow/includes/api/ApiFlowBasePost.php(37): Flow\WorkflowLoader->commit()
#11 /srv/mediawiki/php-1.25wmf22/extensions/Flow/includes/api/ApiFlow.php(81): ApiFlowBasePost->execute()
#12 /srv/mediawiki/php-1.25wmf22/includes/api/ApiMain.php(1037): ApiFlow->execute()
#13 /srv/mediawiki/php-1.25wmf22/includes/api/ApiMain.php(394): ApiMain->executeAction()
#14 /srv/mediawiki/php-1.25wmf22/includes/api/ApiMain.php(367): ApiMain->executeActionWithErrorHandling()
#15 /srv/mediawiki/php-1.25wmf22/api.php(88): ApiMain->execute()
#16 /srv/mediawiki/w/api.php(3): include()
#17 {main}

Event Timeline

Amire80 raised the priority of this task from to High.
Amire80 updated the task description. (Show Details)
Amire80 added a project: StructuredDiscussions.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Mattflaschen-WMF raised the priority of this task from High to Unbreak Now!.Mar 30 2015, 8:50 PM

Errors preventing editing should be Unbreak Now.

Amire80 renamed this task from The header User_talk:Amire80 in he.wikipedia cannot be edited to The header of User_talk:Amire80 in he.wikipedia cannot be edited.Mar 30 2015, 8:54 PM
Amire80 set Security to None.

A simple action=purge was not enough to workaround this.

Okay, the AJAX POST thinks the prev revision is sedrvbz5tz8wrg3x:

Amir_Header_Exception.png (202×1 px, 18 KB)

Used the following on terbium to make the API request without any cache:

ebernhardson@terbium:~$ mwscript eval.php --wiki=hewiki
> $c = Flow\Container::getContainer();

> $c['memcache'] = new HashBagOStuff();

> $req = new FauxRequest( array( 'action' => 'flow', 'format' => 'json', 'page' => urldecode( '%D7%A9%D7%99%D7%97%D7%AA_%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9%3AAmire80' ), 'submodule' => 'view-header', 'vhcontentFormat' => 'wikitext' ) );

> $api = new ApiMain( $req );

> $api->execute();

> var_dump( $api->getResult()->getResultData( array( 'flow', 'view-header', 'result' ) ) );
["flow"]=>
  array(1) {
    ["view-header"]=>
    array(2) {
      ["result"]=>
      array(1) {
        ["header"]=>
        array(5) {
          ["type"]=>
          string(6) "header"
          ["editToken"]=>
          string(2) "+\"
          ["revision"]=>
          array(18) {
            ["_BC_bools"]=>
            array(2) {
              [0]=>
              string(17) "isOriginalContent"
              [1]=>
              string(11) "isModerated"
            }
            ["workflowId"]=>
            string(16) "sduvt68i0oqqq28f"
            ["articleTitle"]=>
            string(27) "שיחת משתמש:Amire80"
            ["revisionId"]=>
            string(16) "seig0u06yhtq0tzo"
            ...

Here the revisionid is seig0u06yhtq0tzo, but making same api request[1] gives revisionid sedrvbz5tz8wrg3x

[1] https://he.wikipedia.org/w/api.php?action=flow&format=json&page=%D7%A9%D7%99%D7%97%D7%AA_%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9%3AAmire80&submodule=view-header&vhcontentFormat=wikitext

We can get the keys that need to be purged from the $c['memcache'] there, basically

$ref = new ReflectionProperty( $c['memcache'], 'bag' );

> $ref->setAccessible( true );

> var_dump( array_keys( $ref->getValue( $c['memcache'] ) ) );
array(15) {
  [0]=>
  string(62) "flowdb:flow_workflow:title:v2::Amire80:discussion:hewiki:3:4.5"
  [1]=>
  string(48) "flowdb:flow_header:workflow:sduvt68i0oqqq28f:4.5"
  [2]=>
  string(45) "flowdb:flow_header:v2:pk:seig0u06yhtq0tzo:4.5"
  [3]=>
  string(45) "flowdb:flow_header:v2:pk:sedrvbz5tz8wrg3x:4.5"
  [4]=>
  string(45) "flowdb:flow_header:v2:pk:se0bbwirna70taso:4.5"
  [5]=>
  string(45) "flowdb:flow_header:v2:pk:se0bbd8dgiqwvau7:4.5"
  [6]=>
  string(45) "flowdb:flow_header:v2:pk:sdzataututktycmf:4.5"
  [7]=>
  string(45) "flowdb:flow_header:v2:pk:sdzasa08w0hszwnm:4.5"
  [8]=>
  string(45) "flowdb:flow_header:v2:pk:sdz1gou6maddn1u6:4.5"
  [9]=>
  string(45) "flowdb:flow_header:v2:pk:sdvtsfqo8eu13uux:4.5"
  [10]=>
  string(45) "flowdb:flow_header:v2:pk:sduyhuxanqwpxqaq:4.5"
  [11]=>
  string(45) "flowdb:flow_header:v2:pk:sduwcj6fnez2m76b:4.5"
  [12]=>
  string(45) "flowdb:flow_header:v2:pk:sduwa0n0v5rxhxxh:4.5"
  [13]=>
  string(45) "flowdb:flow_header:v2:pk:sduw6fq0ggcl03tl:4.5"
  [14]=>
  string(45) "flowdb:flow_header:v2:pk:sduvt6gonyw9pbkf:4.5"
}

But we should really push out a fix to PurgeAction.php that does this for us.

Change 200768 had a related patch set uploaded (by Mattflaschen):
Add header purge code

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

Change 200768 merged by jenkins-bot:
Add header purge code

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

Change 200775 had a related patch set uploaded (by EBernhardson):
Add header purge code

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

Change 200776 had a related patch set uploaded (by EBernhardson):
Add header purge code

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

Change 200775 merged by jenkins-bot:
Add header purge code

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

Change 200776 merged by jenkins-bot:
Add header purge code

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

We decided not to spend the time to figure out the underlying cause, since much of this data-layer code will be rewritten as part of T94029: Spike: Avoid use of merge() in Flow caches and T94028: DB master connections requested by Flow on GET/HEAD requests.

However, it is no longer occurring on this page, and there will be a trivial workaround in the meantime (action=purge).