Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorException: Undefined index: mu on src/Xhgui/Profile.php:385 #343

Closed
ngyuki opened this issue Oct 6, 2020 · 9 comments · Fixed by #362
Closed

ErrorException: Undefined index: mu on src/Xhgui/Profile.php:385 #343

ngyuki opened this issue Oct 6, 2020 · 9 comments · Fixed by #362

Comments

@ngyuki
Copy link

ngyuki commented Oct 6, 2020

Run xhgui with error_reporting=-1.

php -S 0.0.0.0:80 -t webroot/ -d error_reporting=-1

Empty profiler.flags in php-profiler.

$config = [
    'profiler.enable' => function () { return true; },
    'profiler.flags' => [],

    // ...snip...
];
$profiler = new \Xhgui\Profiler\Profiler($config);
$profiler->start();

Show profile results in xhgui, will see following error.

Slim Application Error

The application could not run because of the following error:

Details

Type: ErrorException
Code: 8
Message: Undefined index: mu
File: /xhgui/src/Xhgui/Profile.php
Line: 385

Trace

#0 /xhgui/src/Xhgui/Profile.php(385): Slim\Slim::handleErrors(8, 'Undefined index...', '/xhgui/src/Xhgu...', 385, Array)
#1 /xhgui/src/Xhgui/Controller/RunController.php(102): XHGui\Profile->calculateSelf()
#2 /xhgui/src/routes.php(41): XHGui\Controller\RunController->view()
#3 [internal function]: {closure}()
#4 /xhgui/vendor/slim/slim/Slim/Route.php(468): call_user_func_array(Object(Closure), Array)
#5 /xhgui/vendor/slim/slim/Slim/Slim.php(1355): Slim\Route->dispatch()
#6 /xhgui/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#7 /xhgui/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#8 /xhgui/vendor/slim/slim/Slim/Middleware/SessionCookie.php(110): Slim\Middleware\MethodOverride->call()
#9 /xhgui/src/Xhgui/Middleware/RenderMiddleware.php(14): Slim\Middleware\SessionCookie->call()
#10 /xhgui/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): XHGui\Middleware\RenderMiddleware->call()
#11 /xhgui/vendor/slim/slim/Slim/Slim.php(1300): Slim\Middleware\PrettyExceptions->call()
#12 /xhgui/webroot/index.php(13): Slim\Slim->run()
#13 {main}
@glensc
Copy link
Contributor

glensc commented Oct 6, 2020

@ngyuki: which storage? pdo or mongodb?

@glensc
Copy link
Contributor

glensc commented Oct 6, 2020

seems to be the same problem: #146

@ngyuki
Copy link
Author

ngyuki commented Oct 6, 2020

@glensc Thank you for reply. I using mongodb.

@ngyuki
Copy link
Author

ngyuki commented Oct 7, 2020

#146 (comment)
Yes, xhgui assumes you have cpu profiling enabled throughout the code unfortunately.

If that is case, I think it would be more friendly if ProfilingFlags::CPU and ProfilingFlags::MEMORY could not be disabled.

@glensc
Copy link
Contributor

glensc commented Oct 7, 2020

Is the profiling even useful if you have not enabled any profiling flags?

I believe that just hiding the notices is not a solution. I think the saver here should reject incomplete profiles so they are not recorded at all.

@ngyuki
Copy link
Author

ngyuki commented Oct 7, 2020

I can only confirm it with tideways_xhprof, but even if all the flags are disabled, only the wall time is measured.

I think the problem is that the flag defaults to empty in php-profiler, so xhgui errors in that config.

https://github.com/perftools/php-profiler/blob/master/src/Profiler.php#L280
https://github.com/perftools/php-profiler/blob/46fcefedfcb446a4f8d378e31c1f85a31438573a/src/Profiler.php#L280

@glensc
Copy link
Contributor

glensc commented Oct 7, 2020

so, only wall time is measured is actually useful?

also:

🚧 Never link to branches, share a permalink 🚧

NOTE: edit your post and fix it with a permalink!

@ngyuki
Copy link
Author

ngyuki commented Oct 12, 2020

It's same problem as #146, so I'll close it

@glensc
Copy link
Contributor

glensc commented Oct 24, 2020

I tested submitting only wall time, the output is useful. just cpu and mem columns are empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants