Page MenuHomePhabricator

PhabricatorDataNotAttachedException when rendering project hovercard with username mentioned in project description
Closed, ResolvedPublicBUG REPORT

Description

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

Steps to reproduce:

  1. Make sure https://we.phorge.it/rPd5a28e12a005e7082dab685dd6e615da5213db33 is deployed.
  2. Set up a project tag project which includes a username mention @username in its project description and that user is not the currently logged in user.
  3. In a task comment, write the project tag #project.
  4. Hover over the project tag.

Since deploying upstream 2023.49 we experience quite some exceptions:

[2024-03-19 15:55:08] EXCEPTION: (PhabricatorDataNotAttachedException) Attempting to access attached data on PhabricatorProject, but the data is not actually attached. Before accessing attachable data on an object, you must load and attach it.\n\nData is normally attached by calling the corresponding needX() method on the Query class when the object is loaded. You can also call the corresponding attachX() method explicitly. at [<phorge>/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php:283]
  #0 <#2> PhabricatorLiskDAO::assertAttachedKey(array, string) called at [<phorge>/src/applications/project/storage/PhabricatorProject.php:210]
  #1 <#2> PhabricatorProject::isUserMember(string) called at [<phorge>/src/applications/project/storage/PhabricatorProject.php:147]
  #2 <#2> PhabricatorProject::hasAutomaticCapability(string, PhabricatorUser) called at [<phorge>/src/applications/policy/filter/PhabricatorPolicyFilter.php:539]
  #3 <#2> PhabricatorPolicyFilter::checkCapability(PhabricatorProject, string) called at [<phorge>/src/applications/policy/filter/PhabricatorPolicyFilter.php:268]
  #4 <#2> PhabricatorPolicyFilter::apply(array) called at [<phorge>/src/applications/policy/filter/PhabricatorPolicyFilterSet.php:93]
  #5 <#2> PhabricatorPolicyFilterSet::resolveCapabilities() called at [<phorge>/src/applications/policy/filter/PhabricatorPolicyFilterSet.php:54]
  #6 <#2> PhabricatorPolicyFilterSet::hasCapability(PhabricatorUser, PhabricatorProject, string) called at [<phorge>/src/applications/people/markup/PhabricatorMentionRemarkupRule.php:119]
  #7 <#2> PhabricatorMentionRemarkupRule::didMarkupText() called at [<phorge>/src/infrastructure/markup/remarkup/PhutilRemarkupEngine.php:362]
  #8 <#2> PhutilRemarkupEngine::postprocessText(array) called at [<phorge>/src/infrastructure/markup/PhabricatorMarkupEngine.php:164]
  #9 <#2> PhabricatorMarkupEngine::execute() called at [<phorge>/src/infrastructure/markup/PhabricatorMarkupEngine.php:111]
  #10 <#2> PhabricatorMarkupEngine::process() called at [<phorge>/src/infrastructure/markup/PhabricatorMarkupEngine.php:75]
  #11 <#2> PhabricatorMarkupEngine::renderOneObject(PhabricatorMarkupOneOff, string, PhabricatorUser, PhabricatorProject) called at [<phorge>/src/infrastructure/markup/view/PHUIRemarkupView.php:87]
  #12 <#2> phutil_tag(string, array, PHUIRemarkupView) called at [<phorge>/src/applications/project/view/PhabricatorProjectCardView.php:87] <--- ????
  #13 <#2> phutil_escape_html(PhabricatorProjectCardView) called at [<phorge>/src/infrastructure/markup/render.php:139]
  #14 <#2> phutil_escape_html(array) called at [<phorge>/src/infrastructure/markup/render.php:97]
  #15 <#2> phutil_tag(string, array, array) called at [<phorge>/src/infrastructure/javelin/markup.php:70]
  #16 <#2> javelin_tag(string, array, array) called at [<phorge>/src/view/AphrontTagView.php:161]
  #17 <#2> AphrontTagView::render() called at [<phorge>/src/view/AphrontView.php:222]
  #18 <#2> AphrontView::producePhutilSafeHTML() called at [<phorge>/src/infrastructure/markup/render.php:115]
  #19 <#2> phutil_escape_html(PHUIHovercardView)
  #20 <#2> array_map(string, array) called at [<phorge>/src/infrastructure/markup/render.php:185]
  #21 <#2> hsprintf(string, PHUIHovercardView) called at [<phorge>/src/aphront/response/AphrontResponse.php:326]
  #22 <#2> AphrontResponse::processValueForJSONEncoding(PHUIHovercardView, string)
  #23 <#2> array_walk_recursive(array, array) called at [<phorge>/src/aphront/response/AphrontResponse.php:342]
  #24 <#2> AphrontResponse::encodeJSONForHTTPResponse(array) called at [<phorge>/src/aphront/response/AphrontAjaxResponse.php:58]
  #25 <#2> AphrontAjaxResponse::buildResponseString() called at [<phorge>/src/aphront/response/AphrontResponse.php:70]
  #26 <#2> AphrontResponse::getContentIterator() called at [<phorge>/src/aphront/sink/AphrontHTTPSink.php:112]
  #27 <#2> AphrontHTTPSink::writeResponse(AphrontAjaxResponse) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:380]
  #28 <#2> AphrontApplicationConfiguration::writeResponse(AphrontPHPHTTPSink, AphrontAjaxResponse) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:303]
  #29 phlog(PhabricatorDataNotAttachedException) called at [<phorge>/src/aphront/handler/PhabricatorAjaxRequestExceptionHandler.php:27]
  #30 PhabricatorAjaxRequestExceptionHandler::handleRequestThrowable(AphrontRequest, PhabricatorDataNotAttachedException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #31 AphrontApplicationConfiguration::handleThrowable(PhabricatorDataNotAttachedException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:337]
  #32 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #33 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

This problem does not happen when backing out https://we.phorge.it/rPd5a28e12a005e7082dab685dd6e615da5213db33

Event Timeline

Aklapper created this task.

https://phabricator.wikimedia.org/source/phabricator/browse/wmf%252Fstable/src/applications/people/markup/PhabricatorMentionRemarkupRule.php$119 checks if a mentioned user can access the object they get mentioned in.
Looking at all source code files in the trace, my wild guess is the upstream change in https://we.phorge.it/rPd5a28e12a005e7082dab685dd6e615da5213db33 could be related.

Would make sense. I'd like to get a repro case if possible, but let's try a revert on that commit tomorrow.

Maybe related?

That turns out to be a pre-existing issue (T224662).

Alright, so what we knew:

So all together this made me wonder if this can be triggered by a username mentioned in a project description. Bingo.

Aklapper renamed this task from EXCEPTION: (PhabricatorDataNotAttachedException) Attempting to access attached data on PhabricatorProject, but the data is not actually attached to "EXCEPTION: (PhabricatorDataNotAttachedException) Attempting to access attached data on PhabricatorProject, but the data is not actually attached" when username mentioned in project description.Mar 21 2024, 8:01 PM
Aklapper renamed this task from "EXCEPTION: (PhabricatorDataNotAttachedException) Attempting to access attached data on PhabricatorProject, but the data is not actually attached" when username mentioned in project description to PhabricatorDataNotAttachedException when rendering project hovercard with username mentioned in project description.Mar 21 2024, 8:20 PM
Aklapper updated the task description. (Show Details)
Aklapper moved this task from Backlog to Upstreamed on the Phabricator (Upstream) board.
Aklapper added a project: Upstream.
Aklapper moved this task from Backlog to Reported Upstream on the Upstream board.

This should have gotten resolved by today's deployment pulling and deploying the 2024.19 upstream version. If not, please comment.