Page MenuHomePhabricator

"AphrontDuplicateKeyQueryException" when trying to drag a task from (sub-project) column to other column on parent workboard
Open, LowPublicBUG REPORT

Description

Upstream: https://we.phorge.it/T15650

Trying to drag (non-public) https://phabricator.wikimedia.org/T119413 which is in the S2 space on the https://phabricator.wikimedia.org/tag/community-liaisons/ workboard from the (sub-project) "Apr-Jun-2016" column to the (parent) "Backlog" column, @Elitre and @Aklapper get an error:

Unhandled Exception ("AphrontDuplicateKeyQueryException")
#1062: Duplicate entry 'PHID-PROJ-w2oxxqq7xappt53glrsm-PHID-PCOL-qjdmfzuo6mkde6myazi7-PH' for key 'boardPHID'

Event Timeline

Aklapper mentioned this in Unknown Object (Task).Jul 5 2016, 5:30 PM

Should we add the phabricator-upstream project?

Should we add the phabricator-upstream project?

If you have checked that it actually is an issue in upstream code: yes.

@Aklapper Hi do you know when the problem started. Since if you know when we could look through the commit history and spot the patch that caused it. Then report it upstream. And yes this looks like an upstream task since upstream maintain this feature.

Ive been looking at the commit history and carn't find anything that would cause this.

(Probaly because the default branch for phabricator Wikimedia is production and that branch hasent been updated since march, the default branch will need changing to wmf/stable for me to look.)

The only thing that looks like what might cause this is https://secure.phabricator.com/diffusion/P/change/master/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php;2cb779575dd593bfdae8d751da90022479d530a8

But as you said you are trying to do it to a task that is not public so this may have been a bug before we upgraded phabricator.

My experience of this bug was seconds before filing the report.

Is this fixed in https://secure.phabricator.com/rP74d5ae7bec46dfa26703f00e31aef8eedede2c92 since it talks about comment previews but I'm not sure if it fixes this task?

Is this fixed in https://secure.phabricator.com/rP74d5ae7bec46dfa26703f00e31aef8eedede2c92 since it talks about comment previews but I'm not sure if it fixes this task?

Highly unlikely. Throwing out semi-random commits from upstream asking if that might have fixed it isn't terribly helpful.

I guess then we need to file this upstream since they may be un a where of the problem?

@Paladox: Not necessarily, as long as you have not checked whether it's a local problem or not. Upstream is not a support desk, downstream has to do their homework first.

It is unlikely us since looking at all our repos none interfear with moving tasks from one column to the other.

As a shot in the dark, it would be lovely if someone with DB access could run SELECT p.* from phabricator_project.project_columnposition p JOIN phabricator_maniphest.maniphest_task t WHERE p.objectPHID = t.phid AND (t.id="149690" OR t.id="191671"); for the testcase that Max reported in T198749.

Aklapper added subscribers: Quiddity, • mmodell.

Potential workaround from T169352#3396089: Move the affected task using 'Change project tags' in the dropdown above the comment form.

Has anyone still experienced this in the last 18 months? If not I'm probably just going to decline this...

No reply, hence declining. If this still happens, please set the status of this task back to "Open" via the Add Action... → Change Status dropdown. Thanks!

Aklapper removed a subscriber: • ksmith.

I ran into this again right now. Tried to drag T326890 with Lowest priority (which cannot be set anymore) from the "Apr-Jun 2023" milestone to the "Backlog" column of the parent project on https://phabricator.wikimedia.org/tag/developer-advocacy/ :
#1062: Duplicate entry 'PHID-PROJ-2olj6ckxwlzq3akoznah-PHID-PCOL-isff5rdm3sfceyqo46os...' for key 'boardPHID'

#1062: Duplicate entry 'PHID-PROJ-2olj6ckxwlzq3akoznah-PHID-PCOL-isff5rdm3sfceyqo46os...' for key 'boardPHID' at [AphrontBaseMySQLDatabaseConnection.php:346]

Stack trace:
# AphrontBaseMySQLDatabaseConnection::throwCommonException called at [.../src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:389]
# AphrontBaseMySQLDatabaseConnection::throwQueryCodeException called at [.../src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:321]
# AphrontBaseMySQLDatabaseConnection::throwQueryException called at [.../src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:217]
# AphrontBaseMySQLDatabaseConnection::executeQuery called at [.../src/infrastructure/storage/xsprintf/queryfx.php:8]
queryfx called at [.../src/infrastructure/storage/connection/AphrontDatabaseConnection.php:58]
# AphrontDatabaseConnection::query called at [.../src/infrastructure/storage/lisk/LiskDAO.php:1118]
# LiskDAO::insertRecordIntoDatabase called at [.../src/infrastructure/storage/lisk/LiskDAO.php:954]
# LiskDAO::insert called at [.../src/infrastructure/storage/lisk/LiskDAO.php:923]
# LiskDAO::save called at [.../src/applications/project/engine/PhabricatorBoardLayoutEngine.php:288]
# PhabricatorBoardLayoutEngine::applyPositionUpdates called at [.../src/applications/maniphest/editor/ManiphestTransactionEditor.php:756]
# ManiphestTransactionEditor::applyBoardMove called at [.../src/applications/maniphest/editor/ManiphestTransactionEditor.php:89]
# ManiphestTransactionEditor::applyCustomExternalTransaction called at [.../src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:841]
# PhabricatorApplicationTransactionEditor::applyExternalEffects called at [.../src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1409]
# PhabricatorApplicationTransactionEditor::applyTransactions called at [.../src/applications/project/controller/PhabricatorProjectMoveController.php:138]
# PhabricatorProjectMoveController::handleRequest called at [.../src/aphront/configuration/AphrontApplicationConfiguration.php:284]
# phlog called at [.../src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
# PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable called at [.../src/aphront/configuration/AphrontApplicationConfiguration.php:751]
# AphrontApplicationConfiguration::handleThrowable called at [.../src/aphront/configuration/AphrontApplicationConfiguration.php:296]
# AphrontApplicationConfiguration::processRequest called at [.../src/aphront/configuration/AphrontApplicationConfiguration.php:204]
# AphrontApplicationConfiguration::runHTTPRequest called at [.../webroot/index.php:35]

Old upstream is https://secure.phabricator.com/T13271: Duplicate entry '<projectPHID>-<columnPHID>-<objectPHID>' for key 'boardPHID'

Problem is that phabricator_project.project_columnposition incorrectly thinks the task is still in the "Backlog" column (where we want to move it).

I can imagine a bug in updateWorkboardColumns() in https://we.phorge.it/source/phorge/browse/master/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php$4915 introduced in https://we.phorge.it/rPf97d120c3fe6f560b05e94075fa2bde6c4a07855


Boring debug details:

  • T326890 is PHID-TASK-ytdglz3vi5z6augmsmho
  • Project "Developer-Advocacy" is PHID-PROJ-2olj6ckxwlzq3akoznah
    • Column "Backlog" is PHID-PCOL-isff5rdm3sfceyqo46os
  • Project "Jan-Mar2023" milestone is PHID-PROJ-senosmmgtvolfbxtjnnu, proxied by PHID-PCOL-kpjz6h7s4axbc4makxzb
  • Project "Apr-Jun2023" milestone is PHID-PROJ-tgxsgx3m6wvrlpkeud6g, proxied by PHID-PCOL-6m2lcg7fkw6s7nwszplc
mysql:phstats@m3-slave.eqiad.wmnet [phabricator_maniphest]> SELECT cp.boardPHID, cp.columnPHID, c.name AS columnName, cp.objectPHID, t.id AS taskID, cp.sequence AS seq FROM phabricator_project.project_columnposition cp INNER JOIN phabricator_project.project_column c INNER JOIN phabricator_maniphest.maniphest_task t WHERE cp.objectPHID = t.phid AND c.phid = cp.columnPHID AND cp.objectPHID = "PHID-TASK-ytdglz3vi5z6augmsmho";
+--------------------------------+--------------------------------+------------+--------------------------------+--------+-----+
| boardPHID                      | columnPHID                     | columnName | objectPHID                     | taskID | seq |
+--------------------------------+--------------------------------+------------+--------------------------------+--------+-----+
| PHID-PROJ-2olj6ckxwlzq3akoznah | PHID-PCOL-isff5rdm3sfceyqo46os | Backlog    | PHID-TASK-ytdglz3vi5z6augmsmho | 326890 |   8 |
+--------------------------------+--------------------------------+------------+--------------------------------+--------+-----+
1 row in set (0.001 sec)

phabricator_maniphest.maniphest_transaction seems to be all fine:

mysql:phstats@m3-slave.eqiad.wmnet [phabricator_maniphest]> SELECT FROM_UNIXTIME(dateCreated) AS dateCreated, id, transactionType AS transaction, oldValue, newValue, metadata FROM phabricator_maniphest.maniphest_transaction mt WHERE mt.objectPHID = "PHID-TASK-ytdglz3vi5z6augmsmho" AND (mt.transactionType != "description" AND mt.transactionType != "create" AND mt.transactionType != "priority" AND mt.transactionType != "reassign" AND mt.transactionType != "core:comment" AND mt.transactionType != "core:subscribers" AND mt.transactionType != "core:create" AND mt.transactionType != "core:space" AND mt.transactionType != "core:title" AND mt.transactionType != "core:view-policy" AND mt.transactionType != "core:edit-policy" AND mt.transactionType != "title" AND mt.transactionType != "core:customfield") AND newValue NOT LIKE "%PHID-TASK-%";
+---------------------+---------+--------------+------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+
| dateCreated         | id      | transaction  | oldValue                           | newValue                                                                                                                                             | metadata                                                                              |
+---------------------+---------+--------------+------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+
| 2023-01-12 23:09:28 | 8522132 | core:columns | null                               | [{"columnPHID":"PHID-PCOL-isff5rdm3sfceyqo46os","beforePHIDs":[],"afterPHIDs":[],"boardPHID":"PHID-PROJ-2olj6ckxwlzq3akoznah","fromColumnPHIDs":[]}] | {"core.create":true,"core.groupID":"ro7qtqtafqqpqotswumelnjp63brfzjb"}                |
| 2023-01-12 23:09:28 | 8522133 | core:edge    | []                                 | ["PHID-PROJ-2olj6ckxwlzq3akoznah"]                                                                                                                   | {"edge:type":41,"core.create":true,"core.groupID":"ro7qtqtafqqpqotswumelnjp63brfzjb"} |
| 2023-01-24 15:34:02 | 8553813 | core:edge    | ["PHID-PROJ-2olj6ckxwlzq3akoznah"] | ["PHID-PROJ-senosmmgtvolfbxtjnnu"]                                                                                                                   | {"edge:type":41,"core.groupID":"xplansjt6z6bawhvlgral5jdst5ezxjn"}                    |
| 2023-04-05 20:04:32 | 8760656 | core:edge    | ["PHID-PROJ-senosmmgtvolfbxtjnnu"] | ["PHID-PROJ-tgxsgx3m6wvrlpkeud6g"]                                                                                                                   | {"edge:type":41,"core.groupID":"urhe5k5ynqmqknzg4h7nd4sdflrhn27n"}                    |
+---------------------+---------+--------------+------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+
4 rows in set (0.001 sec)
Aklapper changed the subtype of this task from "Task" to "Bug Report".
Aklapper moved this task from Backlog to Reported Upstream on the Upstream board.
Aklapper updated the task description. (Show Details)