Page MenuHomePhorge

Make "git cat-file" exception messages include repository monogram/slug
Closed, ResolvedPublic

Description

Our Phorge instance host thousands of (mostly imported) repositories from different sources (and with varying quality).
Occasionally we see this in our error logs:

[2023-11-08 22:24:11] EXCEPTION: (Exception) Unexpected object type from `git cat-file`: foobar at [<phorge>/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php:178]
arcanist(), ava(), phorge(), translations(), wmf-ext-misc()
  #0 <#2> DiffusionLowLevelResolveRefsQuery::resolveGitRefs() called at [<phorge>/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php:41]
  #1 <#2> DiffusionLowLevelResolveRefsQuery::executeQuery() called at [<phorge>/src/applications/diffusion/query/lowlevel/DiffusionLowLevelQuery.php:26]
  #2 <#2> DiffusionLowLevelQuery::execute() called at [<phorge>/src/applications/diffusion/conduit/DiffusionResolveRefsConduitAPIMethod.php:37]
  #3 <#2> DiffusionResolveRefsConduitAPIMethod::getResult(ConduitAPIRequest) called at [<phorge>/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php:110]
  #4 <#2> DiffusionQueryConduitAPIMethod::execute(ConduitAPIRequest) called at [<phorge>/src/applications/conduit/method/ConduitAPIMethod.php:156]
  #5 <#2> ConduitAPIMethod::executeMethod(ConduitAPIRequest) called at [<phorge>/src/applications/conduit/call/ConduitCall.php:131]
  #6 <#2> ConduitCall::executeMethod() called at [<phorge>/src/applications/conduit/call/ConduitCall.php:81]
  #7 <#2> ConduitCall::execute() called at [<arcanist>/src/future/MethodCallFuture.php:30]
  #8 <#2> MethodCallFuture::isReady() called at [<arcanist>/src/future/Future.php:63]
  #9 <#2> Future::updateFuture() called at [<arcanist>/src/future/Future.php:159]
  #10 <#2> Future::start() called at [<arcanist>/src/future/FutureIterator.php:403]
  #11 <#2> FutureIterator::moveFutureToWork(integer) called at [<arcanist>/src/future/FutureIterator.php:374]
  #12 <#2> FutureIterator::updateWorkingSet() called at [<arcanist>/src/future/FutureIterator.php:206]
  #13 <#2> FutureIterator::next() called at [<arcanist>/src/future/FutureIterator.php:190]
  #14 <#2> FutureIterator::rewind()
  #15 <#2> iterator_to_array(FutureIterator) called at [<arcanist>/src/future/FutureIterator.php:84]
  #16 <#2> FutureIterator::resolveAll() called at [<arcanist>/src/future/Future.php:47]
  #17 <#2> Future::resolve() called at [<phorge>/src/applications/diffusion/query/DiffusionQuery.php:83]
  #18 <#2> DiffusionQuery::callConduitWithDiffusionRequest(PhabricatorUser, DiffusionGitRequest, string, array) called at [<phorge>/src/applications/diffusion/request/DiffusionRequest.php:682]
  #19 <#2> DiffusionRequest::resolveRefs(array) called at [<phorge>/src/applications/diffusion/controller/DiffusionCompareController.php:58]
  #20 <#2> DiffusionCompareController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #21 phlog(Exception) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #22 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, Exception) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #23 AphrontApplicationConfiguration::handleThrowable(Exception) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #24 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #25 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

foobar in the exception message (originally coming from git) above can have random values; real examples from our error logs are Mail at abc@microsoft.comrouter missing or Jack/(:?!'!/&)9: missing.

In some cases, running git fsck and git gc server-side could mitigate such repository data issues.
However, that obviously requires knowing which repository triggered the exception. Thus the exception message should also output the repository monogram/slug to allow further debugging.