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

Show Call Graph Error (cannot be displayed because it contains errors) #22

Closed
davidb2002 opened this issue Aug 18, 2011 · 49 comments
Closed

Comments

@davidb2002
Copy link

Apologies if this is addressed in other issues.

I have the latest stable release of webgrind and every time I 'Show call Graph' I get the error:

The Image "(image generation url)" cannot be displayed because it contains errors

Any ideas how to fix this?

@lexonight
Copy link

open webgrind wherever it is located on your computer.
if you don't have graphviz download it and install it or download the appropriate package
Edit config.php find this and set the paths to the appropriate paths:
/**
* Path to python executable
*/
static $pythonExecutable = '/usr/bin/python';

/**
* Path to graphviz dot executable
*/  
static $dotExecutable = '/usr/bin/dot';

@tcamin
Copy link

tcamin commented Feb 7, 2012

Hi,

I have graphviz installed (dot is under /usr/bin/dot) and have updated the config.php file accordingly, Still no go on the image generation, anything else I should check?

@dland
Copy link

dland commented Feb 22, 2012

yeah, I'm having a similar problem. Both dot and python are installed. The problem is that library/gprof2dot.py isn't producing any useful output. All it manages to generate is the following preamble:

digraph {
    graph [ranksep=0.25, fontname=Arial, nodesep=0.125];
    node [fontname=Arial, style=filled, height=0, width=0, shape=box, fontcolor=white];
    edge [fontname=Arial];
}

Oddly enough, that won't produce a very interesting picture...

@bananaumai
Copy link

Hi, i also faced same problem.

In my case, i found it was caused by xdebug setting - xdebug.profiler_append

When "xdebug.profiler_append = 1" in php.ini, different request is mapped to the same cachegrind file, which gprof2dot.py cannot parse properly. So, setting "xdebug.profiler_append = 0" in php.ini, I could see the call graph properly.

@sameg14
Copy link

sameg14 commented Apr 9, 2012

the dot executable is referenced incorrectly in the config file.
the correct location, on ubuntu, is

static $dotExecutable = '/usr/bin/dot';

Before this you need to install graphviz

sudo apt-get install graphviz 

@marcioAlmada
Copy link

In my case, the generated image is always a 11x11 blank png. Any ideas why?

@unilama
Copy link

unilama commented Apr 27, 2012

I also have empty graph - using last version of Webgrind (from github) and xdebug version 2.1.0

@samrae
Copy link

samrae commented Jul 18, 2012

Thanks @bananaumai. That worked for me.

@naillizard
Copy link

For brew

brew install graphviz


after installation

config.php

static $dotExecutable = '/usr/local/Cellar/graphviz/x.xx.x/bin/dot';

@imme-emosol
Copy link

i replaced the gprof2dot.py with a symbolic link to a checkout of the script ( http://code.google.com/p/jrfonseca/wiki/Gprof2Dot ) in José Fonseca's utilitities via :
http://code.google.com/p/jrfonseca/source/checkout?repo=gprof2dot .

@danielhunt
Copy link

I'm having problems with this too - a 'missing image' icon is present in Chrome.

(I'm running on OSX - Mountain Lion)
I've debugged the execution of the script in question, in index.php (line 151), and discovered that there were some issues with my tools setup:

/usr/local/bin/dot -Tpng -o /private/var/tmp/cachegrind.out.86257-10.webgrind.pngdyld: Library not loaded: /usr/lib/libltdl.7.dylib
  Referenced from: /usr/local/bin/dot
  Reason: image not found
Trace/BPT trap: 5

To fix this, I did the following (I have homebrew installed already) :

brew install imagemagick
brew link -f imagemagick
brew install graphicsmagick
brew install libtool --universal
brew link libtool

Following this, it all worked as expected.
I think you should work on your error handling as this will likely affect many others on OSX - the exec in particular is problematic, as you're not checking after the exec completes, to see if the image file has been created (no error is output to the screen).

@samtuke
Copy link

samtuke commented Sep 25, 2012

In my case, the generated image is always a 11x11 blank png

Same problem here. Graphviz & python installed and correct in webgrind config file here (Feedora 17).

@StevenMapes
Copy link

Has anyone managed to get it to work on a Windows box at all? Graphviz that is

@StevenMapes
Copy link

Okay I have it working on Windows for anyone who wants to know what to do.

  1. Download python and Graphviz and install them as usual then start editing the PHP files.
  2. Add a static property to Webgrind_Config called $webgrindPath which is the path to the webgrind web accessible folder
  3. Change the $pythonExecutable and $dotExecutable properties to point at your Python and Graphiviz files
  4. Edit index.php and change line 152 (the shell_exec line) so that it includes the webgrind path before the libary/gprof2dot.py as it requires a absolute path to work

So here's an example:

config.php changes

/**
* Path to python executable
*/ 
static $pythonExecutable = 'C:\Python27\python.exe'; // '/usr/bin/python';

/**
* Path to graphviz dot executable
*/  
static $dotExecutable = '"C:\Program Files (x86)\Graphviz 2.28\bin\dot.exe"'; //'/usr/local/bin/dot';

/**
 * Path to the webgrind installation
 */
static $webgrindPath = 'C:\\wamp\\www\\webgrind\\';

index.php changes

shell_exec(Webgrind_Config::$pythonExecutable.' '.Webgrind_Config::$webgrindPath.'library/gprof2dot.py -n '.$showFraction.' -f callgrind '.Webgrind_Config::xdebugOutputDir().''.$dataFile.' | '.Webgrind_Config::$dotExecutable.' -Tpng -o ' . $filename);

@tenken
Copy link

tenken commented Jan 4, 2013

@syntheticintel This worked for me from webgrind-master and Ubuntu 12.04.

@ghost
Copy link

ghost commented Jan 29, 2013

I'm running on OSX - Mountain Lion

line 152 in index.php

shell_exec(Webgrind_Config::$pythonExecutable.' library/gprof2dot.py -n '.$showFraction.' -f callgrind '.Webgrind_Config::xdebugOutputDir().''.$dataFile.' | '.Webgrind_Config::$dotExecutable.' -Tpng -o ' . $filename);

dosn't work, but when run in command line, for example:

/opt/local/bin/python library/gprof2dot.py -n 10 -f callgrind /[path]/xdebug-profiles/xdebug-profile..1359480333 | /usr/local/bin/dot -Tpng -o /[path]/xdebug-profiles/webgrind-cachegrind/xdebug-profile..1359480333-10.webgrind.png

class graph is generated.

Any ideas?

@naillizard
Copy link

check your conf.php for $pythonExecutable it looks like you might have a different path setup there.

try which python from the terminal to see where it is installed and update the path on conf.php

@naillizard
Copy link

also check for your $doExecutable...

@ghost
Copy link

ghost commented Jan 29, 2013

$pythonExecutable

and

$dotExecutable

are set.

I have data from python, i have problem with dot, from cli - ok, but from _shell_exec_ :/

$return = shell_exec('/[dot_path]/dot -V');

$return is null :(

PHP 5.4.4, MAMP server - I spent many hours and nothing ...

@naillizard
Copy link

did you use brew to install dot?

@naillizard
Copy link

After installing dot with brew I had to set $dotExecutable to:

static $dotExecutable = '/usr/local/Cellar/graphviz/2.28.0/bin/dot';

@ghost
Copy link

ghost commented Jan 29, 2013

No, port, dot installed with imagemagick.

@naillizard
Copy link

my bad, yeah graphviz installed via imagemagick, but search in /usr/local/Cellar for graphviz dir.

@naillizard
Copy link

I had problems when setting up webgrind, and turns out was just to do with the paths, from command line everything worked for me...

@ghost
Copy link

ghost commented Jan 29, 2013

mkjasinski@machine ~ $ /usr/local/bin/dot -V
dot - graphviz version 2.30.0 (20130114.0426)
mkjasinski@machine ~ $ 

and $dotExecutable is set to:

static $dotExecutable = '/usr/local/bin/dot';

I have no idea on this, from command line everything worked ...

For phpDocumentator dot works perfectly.

OK, a have bug:

dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
  Expected in: /Applications/MAMP/Library/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib

OK my friends - SOLUTION

vim /Applications/MAMP/Library/bin/envvars
#DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
#export DYLD_LIBRARY_PATH

Have fun!

@naillizard
Copy link

are you able to run

mkjasinski@machine ~ $ dot -V

On 30/01/2013, at 9:16 AM, Marcin notifications@github.com wrote:

mkjasinski@machine ~ $ /usr/local/bin/dot -V
dot - graphviz version 2.30.0 (20130114.0426)
mkjasinski@machine ~ $
and $dotExecutable is set to:

static $dotExecutable = '/usr/local/bin/dot';
I have no idea on this, from command line everything worked ...


Reply to this email directly or view it on GitHub.

@ghost
Copy link

ghost commented Jan 29, 2013

Yes, all is ok :)

@gurpr33t
Copy link

When I click on Show Call Graph button, it opens new page with this error:
The image “http://localhost/webgrind/index.php?dataFile=cachegrind.out.1366388401.7920&showFraction=1&op=function_graph” cannot be displayed because it contains errors.
How to make it work?

@eddiejaoude
Copy link

@lexonight comment, about incorrect paths in the config solved my issue. I removed 'local' out of the path & it now works

@bbaaxx
Copy link

bbaaxx commented Jul 4, 2013

In case you are forced ;) to use XAMPP in Windows this worked fine for me:

/**
* Path to python executable
*/ 
static $pythonExecutable = 'C:\Python27\python.exe';

/**
* Path to graphviz dot executable
*/  
static $dotExecutable = 'C:\Graphviz2.30\bin\dot.exe';

@saada
Copy link

saada commented Dec 12, 2013

Installing graphviz and changing the $dotExecutable path to /usr/bin/dot worked for me on Ubuntu! Thanks guys! 👍

@ghost
Copy link

ghost commented Dec 24, 2013

@michaelhyde
Copy link

Thank you GiumDev! That did it for me (XAMPP).

@nabab
Copy link

nabab commented May 24, 2014

In Windows in XAMPP it's telling me "The image 'http://xxx/__grind/index.php?dataFile=0&showFraction=0.9&op=function_graph' cannot be displayed because it contains errors".
I have set config.php as adviced above by bbaaxx (the path are right for my system).

@slein87
Copy link

slein87 commented Dec 15, 2014

Few providers / clients disable the shell_exec function via "disable_functions" in the php.ini. This will result in a white page when opening the call graph.

@naillizard
Copy link

On-prem server. I can use shell_exec, its not disabled. Clicking on the
Show Call Graph button opens a new page and takes a while to run "guess its
doing its job" but it doesn't save the image. I've already given DefaultApp
full permissions on the directory with icacls and also full permissions to
all users to test and still doesn't work, I'll keep trying and update this
ticket if I find a fix.

FYI.
Running on Windows 8x64
IIS 8 with PHP 5.6 and xdebug 2.2.5
Python 2.7.8 and dot 2.38.0

On 16 December 2014 at 04:05, slein87 notifications@github.com wrote:

Few providers / clients disable the shell_exec function via
"disable_functions" in the php.ini. This will result in a white page when
opening the call graph.


Reply to this email directly or view it on GitHub
#22 (comment).

@vaughany
Copy link

vaughany commented Jun 2, 2015

Thanks @sameg14, got it working in Ubuntu 14.04. 👍

@sameg14
Copy link

sameg14 commented Jun 4, 2015

@vaughany You're very welcome!

@GRMule
Copy link

GRMule commented Jun 5, 2015

I was having trouble getting this to work on Windows 7 as well. For starters, the changes suggested by StevenMapes were necessary. Also necessary was moving GraphViz from the default installation folder (for me, C:\Program Files (x86)\GraphViz) to something without spaces: C:\dot. I tried putting quotes around the path, but I couldn't find a combination that shell_exec liked.

@ve3
Copy link

ve3 commented Dec 29, 2015

@StevenMapes Also works for me except that I did not change anything about index.php shell_exec().

My configuration:

/**
* Path to python executable
*/ 
static $pythonExecutable = 'C:\\Python27\\python.exe';

/**
* Path to graphviz dot executable
*/  
static $dotExecutable = '"C:\\Graphviz2.38\\bin\\dot.exe"';

I was tried Python 3.5 but it is not working, change to 2.7 works fine.

@dbiagi
Copy link

dbiagi commented Apr 13, 2016

I followed the @ve3 solution, and worked fine for me. Thanks =)
I'm using windows btw.

@iranianpep
Copy link

For those who use MAMP. After changing the config.php and setting the path you must restart the server. It worked for me.

@sylvainraye
Copy link

By me I have issue to get the svg file cause of error returned by the python gprof2dot script:

vagrant@jelmoli:/vagrant/htdocs/magento/src/webgrind-master$ /usr/bin/python library/gprof2dot.py -n 10 -f callgrind '/vagrant/cachegrind/cachegrind.out.17500' | /usr/bin/dot -Tsvg -o '/tmp/cachegrind.out.17500-10.webgrind.svg'
Traceback (most recent call last):
  File "library/gprof2dot.py", line 3185, in <module>
    main()
  File "library/gprof2dot.py", line 3149, in main
    profile = parser.parse()
  File "library/gprof2dot.py", line 1569, in parse
    self.profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
  File "library/gprof2dot.py", line 478, in integrate
    self._integrate_function(function, outevent, inevent)
  File "library/gprof2dot.py", line 483, in _integrate_function
    return self._integrate_cycle(function.cycle, outevent, inevent)
  File "library/gprof2dot.py", line 538, in _integrate_cycle
    assert abs(call_ratio*total - partial) <= 0.001*call_ratio*total
AssertionError
vagrant@jelmoli:/vagrant/htdocs/magento/src/webgrind-master$

@alpha0010
Copy link
Collaborator

@diglin gprof2dot is maintained here. Does this same error occur using the upstream script? If so, please report there.

@sylvainraye
Copy link

@alpha0010 yes it does. I'm using a vagrant machine with Ubuntu 14.04 with Python 2.7.6

@alpha0010
Copy link
Collaborator

It appears that is a known issue, that does not have a current plan for a fix. (If you think your case is different, please report on jrfonseca/gprof2dot.)

@sylvainraye
Copy link

sylvainraye commented Nov 29, 2016 via email

@alpha0010
Copy link
Collaborator

To all involved: this is a rather extended thread comprising of a variety of issues, which may or may not be outdated. Closing this ticket; if your issue is still applicable, please open a new ticket.

@vanyabrovary
Copy link

vanyabrovary commented May 26, 2020

apt-get install python3-graphviz

At config.php change python to python3
static $pythonExecutable = '/usr/bin/python3';

And it works.

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

No branches or pull requests