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

Dot makes PSGraph fail with an Out of memory exception #69

Open
larssb opened this issue Jul 22, 2018 · 1 comment
Open

Dot makes PSGraph fail with an Out of memory exception #69

larssb opened this issue Jul 22, 2018 · 1 comment

Comments

@larssb
Copy link

larssb commented Jul 22, 2018

Synopsis

I have programmed a PowerShell function that can analyze a PowerShell module and put out a callgraph over the module. PSGraph is used to generate the graph based on the data retrieved from the module analysis.

The error

When I use Out-PSModuleCallGraph to analyze the code of HealOps I get the following error:

Error: trouble in init_rank
	%0 19
	%0 10
	%0 5
	%0 6
	%0 23
......
  • the list of [%NUMBER NUMBER] is long, so shortened in the above. For the value of info, allow me to mention that commands from the module is mentioned in the list. The error message continues with:
	%0 2
	%0 1
libpath/shortest.c:324: triangulation failed
libpath/shortest.c:192: source point not in any triangle
Error: in routesplines, Pshortestpath failed
dot(82295,0x7fff9a9c9380) malloc: *** mach_vm_map(size=18446744069337296896) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
out of memory
Export-PSGraph : System error.
At /gitRepos/PowerShellTooling/Public/PowerShellInfo/Out-PSModuleCallGraph.ps1:473 char:22
+         $graphData | Export-PSGraph -ShowGraph
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], ParseException
+ FullyQualifiedErrorId : System.Management.Automation.ParseException,Export-PSGraph

For other modules this error is not thrown. E.g for modules like Plaster or Pester.

Tried

I tried searching for suggestions on the reason behind the error. Some mentions an issue with a circular reference. Others suggests setting max_depth or newrank=true but that draws a graph that does not quite have the layout I would like. However, a graph is actually drawn.

I also tried setting cluster as the name for the subgraph used. This also makes generating the graph go thrugh, however, again not with the layout I would like.

Reproducing

  1. Clone HealOps from the linke to the repo.
  2. Download the release of PowerShellTooling
  3. Import the PowerShellTooling module or dot-source directly to the Out-PSModuleCallGraph.ps1 file.
  4. Execute Out-PSModuleCallGraph and point it to the HealOps module root. E.g. > Out-PSModuleCallGraph -ModuleRoot "PATH_TO_HEALOPS_MODULE_ROOT"/HealOps
  5. The same error I describe above should be thrown.

End notes

It would be great if it was possible to generate a graph over HealOps and modules like it (having the same issue) without the error being thrown. See the attached screenshot for an example of the layout I'm tryng to produce. The screenshot if from analyzing another module I'm working on.

Thank you so much for your time.

qwfyk0gb fq4

@larssb larssb changed the title Dot makes PSGraph fail with a Out of memory exception Dot makes PSGraph fail with an Out of memory exception Jul 22, 2018
@larssb
Copy link
Author

larssb commented Jul 30, 2018

I think this one can be closed for now. I cleaned up my code, fixed some errors. The modules, like Pester and my own can now be analyzed with my Out-PSModuleCallGraph function.

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

1 participant