Page MenuHomePhabricator

Error trying to view previous git blame ("Skip past this commit" button): "reset() expects parameter 1 to be array, null given"
Open, Stalled, LowPublicBUG REPORT

Description

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

I was on https://phabricator.wikimedia.org/source/mediawiki-config/browse/master/wmf-config/CommonSettings.php;14aaa8d1fa8401ddb52f7e248bdc816fa1a2aa91$1829-1845 and clicked on the "skip past this commit" button in the blame to skip past https://phabricator.wikimedia.org/rOMWC14476579ffccb1238c81aeb47442c74677c06ee2 (14476579ffcc on line 1829) and got https://phabricator.wikimedia.org/source/mediawiki-config/browse/master/wmf-config/CommonSettings.php;14aaa8d1fa8401ddb52f7e248bdc816fa1a2aa91?before=14476579ffccb1238c81aeb47442c74677c06ee2 which complains about reset() expects parameter 1 to be array, null given.

Uh I can still reproduce:

EXCEPTION: (RuntimeException) reset() expects parameter 1 to be array, null given at [<arcanist>/src/error/PhutilErrorHandler.php:273]
arcanist(), ava(), phorge(), translations(), wmf-ext-misc()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<arcanist>/src/error/PhutilErrorHandler.php:273]
  #1 <#2> reset(NULL) called at [<phorge>/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php:100]
  #2 <#2> DiffusionRenameHistoryQuery::loadCommitSequence(string) called at [<phorge>/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php:45]
  #3 <#2> DiffusionRenameHistoryQuery::loadOldFilename() called at [<phorge>/src/applications/diffusion/controller/DiffusionBrowseController.php:654]
  #4 <#2> DiffusionBrowseController::buildBeforeResponse(string) called at [<phorge>/src/applications/diffusion/controller/DiffusionBrowseController.php:110]
  #5 <#2> DiffusionBrowseController::browseFile() called at [<phorge>/src/applications/diffusion/controller/DiffusionBrowseController.php:48]
  #6 <#2> DiffusionBrowseController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #7 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #8 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #9 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #10 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #11 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]'

Event Timeline

Aklapper renamed this task from Error thrown when trying to view previous git blame in phabricator to Error trying to view previous git blame ("Skip past this commit" button): "reset() expects parameter 1 to be array, null given".Feb 11 2021, 4:24 PM
Aklapper added a project: Diffusion.
reset() expects parameter 1 to be array, null given
Stack trace:
# PhutilErrorHandler::handleError called at [arcanist/src/error/PhutilErrorHandler.php:261]
# reset called at [phabricator/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php:100]
# DiffusionRenameHistoryQuery::loadCommitSequence called at [phabricator/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php:45]
# DiffusionRenameHistoryQuery::loadOldFilename called at [phabricator/src/applications/diffusion/controller/DiffusionBrowseController.php:654]
# DiffusionBrowseController::buildBeforeResponse called at [phabricator/src/applications/diffusion/controller/DiffusionBrowseController.php:110]
# DiffusionBrowseController::browseFile called at [phabricator/src/applications/diffusion/controller/DiffusionBrowseController.php:48]
# DiffusionBrowseController::handleRequest called at [phabricator/src/aphront/configuration/AphrontApplicationConfiguration.php:284]

This is literally https://secure.phabricator.com/T13667#256672 in old upstream.

I see no recent changes to source code files (1, 2) so I assume this is still an issue.

Looking at the code in DiffusionRenameHistoryQuery.php:89, I assume SELECT commitSequence FROM phabricator_repository.repository_pathchange WHERE (repositoryID = "PHID-REPO-5qissrjui3b35nz2mmif" OR repositoryID = 989) AND commitID = "14476579ffccb1238c81aeb47442c74677c06ee2"; is null. (Cannot check as I don't have DB permissions.)

Aklapper changed the subtype of this task from "Task" to "Bug Report".

Indeed, SELECT commitSequence FROM phabricator_repository.repository_pathchange WHERE commitID = "14476579ffccb1238c81aeb47442c74677c06ee2"; has zero results in the DB

This makes no sense, as commitIDs are integer only. I need to check the code more thoroughly.

We are looking at the URI https://phabricator.wikimedia.org/source/mediawiki-config/browse/master/wmf-config/CommonSettings.php;14aaa8d1fa8401ddb52f7e248bdc816fa1a2aa91?before=14476579ffccb1238c81aeb47442c74677c06ee2
which includes the two Commit IDs:

  • 14476579ffccb1238c81aeb47442c74677c06ee2 (before)
  • 14aaa8d1fa8401ddb52f7e248bdc816fa1a2aa91 (current)

mysql:phstats@m3-slave.eqiad.wmnet [phabricator_repository]> SELECT pc.commitSequence FROM phabricator_repository.repository_pathchange pc INNER JOIN phabricator_repository.repository_commit co ON pc.commitID = co.id WHERE pc.repositoryID = 989 AND co.commitIdentifier = "14476579ffccb1238c81aeb47442c74677c06ee2" LIMIT 1;
does create output (actually three entries).

mysql:phstats@m3-slave.eqiad.wmnet [phabricator_repository]> SELECT pc.commitSequence FROM phabricator_repository.repository_pathchange pc INNER JOIN phabricator_repository.repository_commit co ON pc.commitID = co.id WHERE pc.repositoryID = 989 AND co.commitIdentifier = "14aaa8d1fa8401ddb52f7e248bdc816fa1a2aa91" LIMIT 1;
does not create output: Empty set.

Because https://phabricator.wikimedia.org/rOMWC14aaa8d1fa8401ddb52f7e248bdc816fa1a2aa91 says Still Importing... This commit is still importing. Changes will be visible once the import finishes.

I think that's the culprit.

In a local git checkout, that commit renders correctly via [mediawiki-config]$ git show 14aaa8d1fa8401ddb52f7e248bdc816fa1a2aa91

We also see that "Still Importing..." also in a bunch of other commits, e.g. https://phabricator.wikimedia.org/rOPUP1005598170c55c3a47f02ea72328435415a8d30f

Question is how to see/find the corresponding daemon task ID, and a log which provides pointers about the underlying issue.
grep -r "Error while executing Task" /var/log/phd/daemons.log provides no results.
https://phabricator.wikimedia.org/daemon/ shows nothing stuck.
cf https://we.phorge.it/Q55

May want to finish cleanup in T362021 first anyway.

After running ./bin/repository reparse --importing --trace rOMWC14aaa8d1fa8401ddb52f7e248bdc816fa1a2aa91 I cannot reproduce this issue anymore.

So indeed this exception is directly linked to stuck imports of commits. Code could probably made more robust...

Aklapper moved this task from Backlog to Upstreamed on the Phabricator (Upstream) board.
Aklapper updated the task description. (Show Details)
Aklapper changed the task status from Open to Stalled.Jul 22 2024, 3:24 PM
Aklapper moved this task from Backlog to Patch proposed upstream on the Upstream board.