Error viewing past notifications

I’m seeing an issue with viewing old notifications. On the “All Notifications” page, if I click “Next” (example URL http://phab.myinstall:8001/notification/query/all/?after=6915415957737583421), the page errors out.

The error I get is identical to that in Mail details view broken. Similar to that report, I am unable to reproduce so far. I have tried, but maybe it’s content or configuration dependent.

The stack trace shows:

[Sat Jan 09 21:37:35.340510 2021] [:error] [pid 10222] [client 10.0.64.40:37057] [2021-01-09 21:37:35] EXCEPTION: (Exception) Rows passed to "loadAllFromArray(...)" include two or more rows with the same ID ("1204144"). Rows must have unique IDs. An underlying query may be missing a GROUP BY. at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:659]
[Sat Jan 09 21:37:35.341235 2021] [:error] [pid 10222] [client 10.0.64.40:37057] arcanist(head=master, ref.master=4b3baca999a4), phabricator(head=20200523, ref.20200523=3a6001a19976)
[Sat Jan 09 21:37:35.341251 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #0 <#2> LiskDAO::loadAllFromArray(array) called at [<phabricator>/src/applications/feed/story/PhabricatorFeedStory.php:44]
[Sat Jan 09 21:37:35.341256 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #1 <#2> PhabricatorFeedStory::loadAllFromRows(array, PhabricatorUser) called at [<phabricator>/src/applications/notification/query/PhabricatorNotificationQuery.php:70]
[Sat Jan 09 21:37:35.341261 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #2 <#2> PhabricatorPolicyAwareQuery::execute() called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:180]
[Sat Jan 09 21:37:35.341266 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #3 <#2> PhabricatorPolicyAwareQuery::executeOne() called at [<phabricator>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:98]
[Sat Jan 09 21:37:35.341271 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #4 <#2> PhabricatorCursorPagedPolicyAwareQuery::newInternalCursorFromExternalCursor(string) called at [<phabricator>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:184]
[Sat Jan 09 21:37:35.341275 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #5 <#2> PhabricatorCursorPagedPolicyAwareQuery::getInternalCursorFromExternalCursor(string) called at [<phabricator>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:621]
[Sat Jan 09 21:37:35.341296 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #6 <#2> PhabricatorCursorPagedPolicyAwareQuery::buildPagingClause(AphrontMySQLiDatabaseConnection) called at [<phabricator>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:572]
[Sat Jan 09 21:37:35.341303 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #7 <#2> PhabricatorCursorPagedPolicyAwareQuery::buildPagingWhereClause(AphrontMySQLiDatabaseConnection) called at [<phabricator>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:494]
[Sat Jan 09 21:37:35.341308 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #8 <#2> PhabricatorCursorPagedPolicyAwareQuery::buildWhereClauseParts(AphrontMySQLiDatabaseConnection) called at [<phabricator>/src/applications/notification/query/PhabricatorNotificationQuery.php:80]
[Sat Jan 09 21:37:35.341313 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #9 <#2> PhabricatorNotificationQuery::buildWhereClauseParts(AphrontMySQLiDatabaseConnection) called at [<phabricator>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:484]
[Sat Jan 09 21:37:35.341318 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #10 <#2> PhabricatorCursorPagedPolicyAwareQuery::buildWhereClause(AphrontMySQLiDatabaseConnection) called at [<phabricator>/src/applications/notification/query/PhabricatorNotificationQuery.php:63]
[Sat Jan 09 21:37:35.341323 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #11 <#2> PhabricatorNotificationQuery::loadPage() called at [<phabricator>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:251]
[Sat Jan 09 21:37:35.341327 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #12 <#2> PhabricatorPolicyAwareQuery::execute() called at [<phabricator>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:379]
[Sat Jan 09 21:37:35.341343 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #13 <#2> PhabricatorCursorPagedPolicyAwareQuery::executeWithCursorPager(AphrontCursorPagerView) called at [<phabricator>/src/applications/search/engine/PhabricatorApplicationSearchEngine.php:1038]
[Sat Jan 09 21:37:35.341348 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #14 <#2> PhabricatorApplicationSearchEngine::executeQuery(PhabricatorNotificationQuery, AphrontCursorPagerView) called at [<phabricator>/src/applications/search/controller/PhabricatorApplicationSearchController.php:256]
[Sat Jan 09 21:37:35.341353 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #15 <#2> PhabricatorApplicationSearchController::processSearchRequest() called at [<phabricator>/src/applications/search/controller/PhabricatorApplicationSearchController.php:91]
[Sat Jan 09 21:37:35.341358 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #16 <#2> PhabricatorApplicationSearchController::processRequest() called at [<phabricator>/src/aphront/AphrontController.php:29]
[Sat Jan 09 21:37:35.341362 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #17 <#2> AphrontController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/AphrontController.php:71]
[Sat Jan 09 21:37:35.341366 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #18 <#2> AphrontController::delegateToController(PhabricatorApplicationSearchController) called at [<phabricator>/src/applications/notification/controller/PhabricatorNotificationListController.php:14]
[Sat Jan 09 21:37:35.341379 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #19 <#2> PhabricatorNotificationListController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:288]
[Sat Jan 09 21:37:35.341384 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #20 phlog(Exception) called at [<phabricator>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
[Sat Jan 09 21:37:35.341402 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #21 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, Exception) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:752]
[Sat Jan 09 21:37:35.341406 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #22 AphrontApplicationConfiguration::handleThrowable(Exception) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:300]
[Sat Jan 09 21:37:35.341411 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #23 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:211]
[Sat Jan 09 21:37:35.341415 2021] [:error] [pid 10222] [client 10.0.64.40:37057]   #24 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:35]

I’ve updated very recently. My branch changes are negligible.

Library Version Date Branchpoint
phabricator 3a6001a19976 Sat, Jan 9 b2ab18f8f3d0
arcanist 4b3baca999a4 Oct 16 2020

I get the same error, with an up to date instance. Phabricator on the stable branch of week 8, arcanist on the stable branch of week 7.

Thanks. I filed this upstream as https://secure.phabricator.com/T13623 and suspect it will be fixed by https://secure.phabricator.com/D21577. This patch is a little finicky so I’m not planning to land it until after the release cut later today, but this should be fixed in next week’s release, or in master some time later today after the release cut.

Reproduction in the wild requires some set of steps like:

  • Have 100 or more notifications.
  • Have your 100th notification be a notification which was sent to multiple users.
  • Click “Next”.

(This is now in master.)