jokkedk/webgrind

No output after loading a cachegrind file

SagnikGanguly96 opened this issue · 12 comments

When I've tried to load cachegrind file, no output is generated in Webgrind. Here's my versions:
Webgrind: 1.9
XDebug: 3.1.3
PHP: 8.1.0
OS: Windows 10 (x64)

Anyway I found the error below when clicking on "Update" button, it sends a XHR request and the response is:
Fatal error: Uncaught ValueError: fread(): Argument #2 ($length) must be greater than 0 in E:\httpd\htdocs\tools\webgrind\library\Reader.php:255 Stack trace: #0 E:\httpd\htdocs\tools\webgrind\library\Reader.php(255): fread() #1 E:\httpd\htdocs\tools\webgrind\library\Reader.php(91): Webgrind_Reader->read() #2 E:\httpd\htdocs\tools\webgrind\library\Reader.php(76): Webgrind_Reader->init() #3 E:\httpd\htdocs\tools\webgrind\library\FileHandler.php(166): Webgrind_Reader->__construct() #4 E:\httpd\htdocs\tools\webgrind\index.php(43): Webgrind_FileHandler->getTraceReader() #5 {main} thrown in E:\httpd\htdocs\tools\webgrind\library\Reader.php on line 255

Same with the current docker image:

<br />
<b>Warning</b>:  fread(): Length parameter must be greater than 0 in <b>/var/www/html/library/Reader.php</b> on line <b>247</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /var/www/html/library/Reader.php:247) in <b>/var/www/html/index.php</b> on line <b>243</b><br />
...json stuf...

Could you provide a cachegrind file that that triggers this error?

Hi @ricardoboss, @alpha0010, I would like to inform you that I've solved the problem. I'm sorry I forgot to inform the same hereafter opening the issue.

@ricardoboss, I've manually gone through all the related files of the 'Webgrind' library to find out the exact cause and I found the error I've already mentioned in my first comment then to solve the above problem I found that actually webgrind doesn't extract the compressed XDebug profiles to parse, instead, it parses only raw XDebug profiles. So the problem could be solved by just disabling compression (in my case) which could be done using xdebug.use_compression = false.
And here's my 99-xdebug.ini configured for profiling:

zend_extension = xdebug
;xdebug.mode = develop
xdebug.mode = profile
xdebug.output_dir = "E:/php/common/tmp/XDebug/Profile"
xdebug.profiler_enable = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.use_compression  = false
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.show_local_vars = 1

Thanks for the update.

Compression support already in master; I forgot to tag a release for it... will do so soon.

I'm new to Webgrind and I just ran in to this issue as well. I thought I was going crazy, as you get no error it just doesn't work.

I can confirm this is fixed on master.

Hi, would it be possible to release a tag with the compression support? Thank you!