Exception Caught: Row has null primary key
Closed, ResolvedPublic

Description

Reported by @Etonkovidova at https://phabricator.wikimedia.org/T110358#1576773:

"
In betalabs it happens only when a board description has a template(any template) and that template was deleted and 'Save changes' was clicked:

Delete a content from a board descirption.
In wikitext code - add [[Category:Flow|*]] - click on 'Save description'

"
(Adding the category is not needed to reproduce).

The following error is displayed:
[32ec9d4d] Exception Caught: Row has null primary key:

2015-08-26 19:42:35 deployment-mediawiki02 enwiki exception ERROR: [32ec9d4d] /w/api.php   Flow\Exception\DataPersistenceException from line 117 of /srv/mediawiki/php-master/extensions/Flow/includes/Data/Storage/BasicDbStorage.php: Row has null primary key:  {"exception":"[Exception Flow\\Exception\\DataPersistenceException] (/srv/mediawiki/php-master/extensions/Flow/includes/Data/Storage/BasicDbStorage.php:117) Row has null primary key: 
[stacktrace]
#0 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ObjectManager.php(187): Flow\\Data\\Storage\\BasicDbStorage->remove(array)
#1 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ObjectManager.php(202): Flow\\Data\\ObjectManager->remove(Flow\\Model\\WikiReference, array)
#2 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ManagerGroup.php(97): Flow\\Data\\ObjectManager->multiRemove(array, array)
#3 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ManagerGroup.php(114): Flow\\Data\\ManagerGroup->multiMethod(string, array, array)
#4 /srv/mediawiki/php-master/extensions/Flow/includes/Data/Listener/ReferenceRecorder.php(77): Flow\\Data\\ManagerGroup->multiRemove(array)
#5 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ObjectManager.php(261): Flow\\Data\\Listener\\ReferenceRecorder->onAfterInsert(Flow\\Model\\Header, array, array)
#6 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ObjectManager.php(170): Flow\\Data\\ObjectManager->insert(array, array)
#7 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ObjectManager.php(143): Flow\\Data\\ObjectManager->multiPut(array, array)
#8 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ManagerGroup.php(80): Flow\\Data\\ObjectManager->put(Flow\\Model\\Header, array)
#9 /srv/mediawiki/php-master/extensions/Flow/includes/Block/Header.php(175): Flow\\Data\\ManagerGroup->put(Flow\\Model\\Header, array)
#10 /srv/mediawiki/php-master/extensions/Flow/includes/SubmissionHandler.php(141): Flow\\Block\\HeaderBlock->commit()
#11 /srv/mediawiki/php-master/extensions/Flow/includes/WorkflowLoader.php(66): Flow\\SubmissionHandler->commit(Flow\\Model\\Workflow, array)
#12 /srv/mediawiki/php-master/extensions/Flow/includes/Api/ApiFlowBasePost.php(41): Flow\\WorkflowLoader->commit(array)
#13 /srv/mediawiki/php-master/extensions/Flow/includes/Api/ApiFlow.php(106): Flow\\Api\\ApiFlowBasePost->execute()
#14 /srv/mediawiki/php-master/includes/api/ApiMain.php(1093): Flow\\Api\\ApiFlow->execute()
#15 /srv/mediawiki/php-master/includes/api/ApiMain.php(432): ApiMain->executeAction()
#16 /srv/mediawiki/php-master/includes/api/ApiMain.php(405): ApiMain->executeActionWithErrorHandling()
#17 /srv/mediawiki/php-master/api.php(88): ApiMain->execute()
#18 /srv/mediawiki/w/api.php(3): include(string)
#19 {main}
"}

This is probably somehow related to T107204: Separate reference tables by wiki

Mattflaschen-WMF updated the task description. (Show Details)
Mattflaschen-WMF raised the priority of this task from to High.
Mattflaschen-WMF claimed this task.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 26 2015, 8:49 PM

View history - http://en.wikipedia.beta.wmflabs.org/w/index.php?title=Talk:ET27&action=undo-edit-header&header_startId=snqym44903kru3qj&header_endId=snqymnq9cqwc71g8

Undo an edit in which e.g. {{CURRENTTIMESTAMP}} was deleted

Click on 'Save description', the following error is displayed:
Error
An error has occurred while processing the data in your request.

Return to Main Page

[8fc38f25] /w/index.php?title=Talk:ET27&action=undo-edit-header&header_startId=snqym44903kru3qj&header_endId=snqymnq9cqwc71g8 Flow\Exception\DataPersistenceException from line 117 of /srv/mediawiki/php-master/extensions/Flow/includes/Data/Storage/BasicDbStorage.php: Row has null primary key:

Backtrace:

#0 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ObjectManager.php(187): Flow\Data\Storage\BasicDbStorage->remove(array)
#1 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ObjectManager.php(202): Flow\Data\ObjectManager->remove(Flow\Model\WikiReference, array)
#2 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ManagerGroup.php(97): Flow\Data\ObjectManager->multiRemove(array, array)
#3 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ManagerGroup.php(114): Flow\Data\ManagerGroup->multiMethod(string, array, array)
#4 /srv/mediawiki/php-master/extensions/Flow/includes/Data/Listener/ReferenceRecorder.php(77): Flow\Data\ManagerGroup->multiRemove(array)
#5 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ObjectManager.php(261): Flow\Data\Listener\ReferenceRecorder->onAfterInsert(Flow\Model\Header, array, array)
#6 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ObjectManager.php(170): Flow\Data\ObjectManager->insert(array, array)
#7 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ObjectManager.php(143): Flow\Data\ObjectManager->multiPut(array, array)
#8 /srv/mediawiki/php-master/extensions/Flow/includes/Data/ManagerGroup.php(80): Flow\Data\ObjectManager->put(Flow\Model\Header, array)
#9 /srv/mediawiki/php-master/extensions/Flow/includes/Block/Header.php(175): Flow\Data\ManagerGroup->put(Flow\Model\Header, array)
#10 /srv/mediawiki/php-master/extensions/Flow/includes/SubmissionHandler.php(141): Flow\Block\HeaderBlock->commit()
#11 /srv/mediawiki/php-master/extensions/Flow/includes/WorkflowLoader.php(66): Flow\SubmissionHandler->commit(Flow\Model\Workflow, array)
#12 /srv/mediawiki/php-master/extensions/Flow/includes/View.php(146): Flow\WorkflowLoader->commit(array)
#13 /srv/mediawiki/php-master/extensions/Flow/includes/View.php(58): Flow\View->handleSubmit(Flow\WorkflowLoader, string, array)
#14 /srv/mediawiki/php-master/extensions/Flow/includes/Actions/Action.php(101): Flow\View->show(Flow\WorkflowLoader, string)
#15 /srv/mediawiki/php-master/extensions/Flow/includes/Actions/Action.php(46): Flow\Actions\FlowAction->showForAction(string)
#16 /srv/mediawiki/php-master/includes/MediaWiki.php(456): Flow\Actions\FlowAction->show()
#17 /srv/mediawiki/php-master/includes/MediaWiki.php(255): MediaWiki->performAction(Article, Title)
#18 /srv/mediawiki/php-master/includes/MediaWiki.php(683): MediaWiki->performRequest()
#19 /srv/mediawiki/php-master/includes/MediaWiki.php(474): MediaWiki->main()
#20 /srv/mediawiki/php-master/index.php(41): MediaWiki->run()
#21 /srv/mediawiki/w/index.php(3): include(string)
#22 {main}

This might be fixed by Matthias's change, https://gerrit.wikimedia.org/r/#/c/233432/ . We also need to set that $wgFlowMigrateReferenceWiki to false on Beta after I fix the DB inconsistencies.

DannyH set Security to None.

Saving a description with a template (e.g. {{cite web}}, then blanking it, is sufficient to reproduce. It's not necessary to add a category afterwards.

Change 235179 had a related patch set uploaded (by Mattflaschen):
Fix removing references by using right PK, only right indexes

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

Change 235179 merged by jenkins-bot:
Fix removing references by using right PK, only right indexes

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

Checked in betalabs - all is fixed.

  • removing templates
  • removing categories/links
  • Undo these previous actions from History
DannyH closed this task as Resolved.Sep 2 2015, 5:36 PM
DannyH added a subscriber: DannyH.