A
A
Alexander Kazakov2019-11-18 16:28:37
PHP
Alexander Kazakov, 2019-11-18 16:28:37

Why does xhprof give "Invalid Run Id"?

Good day!
There is a site on BitrixVM (CentOS 7), php7.1 and xhprof port for version 7 installed from https://github.com/rustjson/xhprof
I assembled it manually according to the instructions. Apache picks up the extension, it is also shown in phpinfo.
I run a test file from the browser with the following code:

# Инициализируем профайлер
if (extension_loaded('xhprof')) {
    include_once '/home/bitrix/www/xhprof/xhprof_lib/utils/xhprof_lib.php';
    include_once '/home/bitrix/www/xhprof/xhprof_lib/utils/xhprof_runs.php';
     
    xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
}

echo "1";
sleep(10);
echo "2";

if (extension_loaded('xhprof')) {
     $profilerNamespace = '111';
     $xhprofData = xhprof_disable();
     $xhprofRuns = new XHProfRuns_Default();
     $runId = $xhprofRuns->save_run($xhprofData, $profilerNamespace);
 }

The script is working. Files with debugging information appear in the directory.
wc_za2vh4gh1h39lenqjc3pin0y.jpeg
But when you try to open it in all files, it shows empty output and the error invalid run id:
dkcdcd9wcq-dslkk335nbjwe7wu.jpeg
But at the same time, if you read the file through cat in the console, or through a text editor, then there is data with an array inside
a:4:{s:14:"main()==>sleep";a:2:{s:2:"ct";i:1;s:2:"wt";i:9998437;}s:25:"main()==>extension_loaded";a:2:{s:2:"ct";i:1;s:2:"wt";i:11;}s:23:"main()==>xhprof_disable";a:2:{s:2:"ct";i:1;s:2:"wt";i:2;}s:6:"main()";a:2:{s:2:"ct";i:1;s:2:"wt";i:9998498;}}

Googling yielded no results. The rights to the xhprof folders are recursively 777.
Please help me understand what the problem is. Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexandr Kazakov, 2019-11-18
@ferym

Found what the problem is. NameSpace should be without dots...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question