Page MenuHomePhabricator

XHGui broken: Invalid argument supplied for foreach
Closed, ResolvedPublic

Description

Whenever I try to open a request on xhgui (example), I get the following:

Details
Type: ErrorException
Code: 2
Message: Invalid argument supplied for foreach()
File: /srv/xhgui/src/Xhgui/Profile.php
Line: 365
Trace
#0 /srv/xhgui/src/Xhgui/Profile.php(365): Slim\Slim::handleErrors(2, 'Invalid argumen...', '/srv/xhgui/src/...', 365, Array)
#1 /srv/xhgui/src/Xhgui/Controller/Run.php(97): Xhgui_Profile->calculateSelf()
#2 /srv/xhgui/src/routes.php(30): Xhgui_Controller_Run->view()
#3 [internal function]: {closure}()
#4 /srv/xhgui/vendor/slim/slim/Slim/Route.php(468): call_user_func_array(Object(Closure), Array)
#5 /srv/xhgui/vendor/slim/slim/Slim/Slim.php(1355): Slim\Route->dispatch()
#6 /srv/xhgui/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#7 /srv/xhgui/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#8 /srv/xhgui/vendor/slim/slim/Slim/Middleware/SessionCookie.php(110): Slim\Middleware\MethodOverride->call()
#9 /srv/xhgui/src/Xhgui/Middleware/Render.php(11): Slim\Middleware\SessionCookie->call()
#10 /srv/xhgui/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Xhgui_Middleware_Render->call()
#11 /srv/xhgui/vendor/slim/slim/Slim/Slim.php(1300): Slim\Middleware\PrettyExceptions->call()
#12 /srv/xhgui/webroot/index.php(10): Slim\Slim->run()
#13 {main}

Event Timeline

@Daimona How did you get to the URL? Did you click on it directly from https://performance.wikimedia.org/xhgui/ the moment before, or was it an older link from before?

For current links on that list, each of the timestamp/permalinks seem to work for me.

Krinkle triaged this task as Medium priority.Dec 9 2019, 10:03 PM
Krinkle moved this task from Inbox, needs triage to Doing (old) on the Performance-Team board.

@Krinkle I had clicked on the "POST" link to the left. I confirm that the most recent requests work correctly, however some entries still yield the error. The one above can be seen at page 2 (currently), and its time is Dec 7th 10:45:59

I'm not sure what else to investigate here currently as it seems to work for both of us.

It is not that strange for data to sometimes not arrive (given it's post-send and no retry, also the server is deprecated awaiting migration per T180761).

But, for this case it looks like it arrived initially and you got it to show in the list, but then opening it didn't work and it no longer appeared in the list? that would suggest it was deleted somehow which is suspicious indeed. Do re-open or file anew if it happens again!

It's happening again, for some requests. See for instance this one; most of the recent requests at https://performance.wikimedia.org/xhgui/ seem to be triggering the bug as well.

Thanks, I can reproduce it now and I have confirmed that the request ID in question did get its profile added to the general list of profiles, so it shows up in the normal navigation:

Screenshot 2020-01-22 at 21.59.40.png (610×2 px, 239 KB)

Which then renders as

Screenshot 2020-01-22 at 22.00.44.png (1×1 px, 261 KB)

Thanks.

Krinkle moved this task from Doing (old) to Inbox, needs triage on the Performance-Team board.
Krinkle added subscribers: dpifke, Krinkle.

Given that we're in the midst of moving XHGui to a newer Debian and Mongo version, and that the current version we use is known to be unsupported by the version of XHGui we use, I'd rather we move until T180761 is finalised.

If it is still an issue after that, we can investigate more closely at what the db rows look like and what may've gone wrong there.

CC-ing @dpifke for whom this would be a good first bug.

Krinkle changed the task status from Open to Stalled.Jan 22 2020, 10:02 PM
Krinkle assigned this task to dpifke.

FWIW, a note that I'm seeing breakage for new runs:

Details
Type: MongoResultException
Code: 2
Message: 127.0.0.1:27017: unrecognized field "cursor
File: /srv/xhgui/src/Xhgui/Searcher/Mongo.php
Line: 121
Trace

#0 /srv/xhgui/src/Xhgui/Searcher/Mongo.php(121): MongoCollection->aggregate(Array, Array)
#1 /srv/xhgui/src/Xhgui/Controller/Run.php(233): Xhgui_Searcher_Mongo->getPercentileForUrl(90, '//Xjhp-wpAIHsAA...', Array)
#2 /srv/xhgui/src/routes.php(53): Xhgui_Controller_Run->url()
#3 [internal function]: {closure}()
#4 /srv/xhgui/vendor/slim/slim/Slim/Route.php(468): call_user_func_array(Object(Closure), Array)
#5 /srv/xhgui/vendor/slim/slim/Slim/Slim.php(1355): Slim\Route->dispatch()
#6 /srv/xhgui/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#7 /srv/xhgui/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#8 /srv/xhgui/vendor/slim/slim/Slim/Middleware/SessionCookie.php(110): Slim\Middleware\MethodOverride->call()
#9 /srv/xhgui/src/Xhgui/Middleware/Render.php(11): Slim\Middleware\SessionCookie->call()
#10 /srv/xhgui/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Xhgui_Middleware_Render->call()
#11 /srv/xhgui/vendor/slim/slim/Slim/Slim.php(1300): Slim\Middleware\PrettyExceptions->call()
#12 /srv/xhgui/webroot/index.php(10): Slim\Slim->run()
#13 {main}

From: https://performance.wikimedia.org/xhgui/url/view?url=%2F%2FXjhp-wpAIHsAAEb5lOQAAAAV%2Fwiki%2FMain_Page

Might be something altogether different, but I figured I'd flag it here in case it's related.

@brennen That's T237002. The immediate problem is that searching by url wasn't supported in our outdated XHGui schema (will be fixed by the upgrade as part of T180761). However what's more useful to know is that when the error is fixed, this link still doesn't go to what you were looking for.

In XHGui, clicking the url in a list, produces a query for listing profiles with the same url. Given we use the url as our unique ID, that would essentially just link to the page you were already on. What you were looking for presumably is to open the detailed profile that was recorded during that debug request. To do so, click on the timestamp "permalink" instead. In your case, that would lead to https://performance.wikimedia.org/xhgui/run/view?id=5e386a003f3dfa823599c2ee.