mingrammer / diagrams

:art: Diagram as Code for prototyping cloud system architectures
https://diagrams.mingrammer.com
MIT License
36.83k stars 2.39k forks source link

Nested Cluster Example Fails with assertion error. #541

Closed hyakuhei closed 3 years ago

hyakuhei commented 3 years ago

Copy and pasting the example from here: https://diagrams.mingrammer.com/docs/guides/cluster

exits with an error

rgc@147ddacd2a9b:~/Code/ThreatModels/EKS-Connector|main⚡ ⇒  python3 architecture.py && open eks_connector.png
Traceback (most recent call last):
  File "/Users/rgc/Code/ThreatModels/EKS-Connector/architecture.py", line 28, in <module>
    handlers >> dw
  File "/Users/rgc/Code/ThreatModels/EKS-Connector/.venv/lib/python3.9/site-packages/diagrams/__init__.py", line 149, in __exit__
    self.render()
  File "/Users/rgc/Code/ThreatModels/EKS-Connector/.venv/lib/python3.9/site-packages/diagrams/__init__.py", line 191, in render
    self.dot.render(format=self.outformat, view=self.show, quiet=True)
  File "/Users/rgc/Code/ThreatModels/EKS-Connector/.venv/lib/python3.9/site-packages/graphviz/files.py", line 243, in render
    rendered = backend.render(self._engine, format, filepath,
  File "/Users/rgc/Code/ThreatModels/EKS-Connector/.venv/lib/python3.9/site-packages/graphviz/backend.py", line 223, in render
    run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet)
  File "/Users/rgc/Code/ThreatModels/EKS-Connector/.venv/lib/python3.9/site-packages/graphviz/backend.py", line 183, in run
    raise CalledProcessError(proc.returncode, cmd,
graphviz.backend.CalledProcessError: Command '['dot', '-Kdot', '-Tpng', '-O', 'event_processing']' died with <Signals.SIGABRT: 6>. [stderr: b'Assertion failed: (sz >= 2), function convertSPtoRoute, file ortho.c, line 155.\n']

I also tried a simpler nested cluster:

with Diagram("TEST", show=False, direction="LR"):
    console = ManagementConsole("Console")

    with Cluster("FE systems"):
        fe = EKS("Front End")
        skylens = EC2Instance("Skylens")

    with Cluster("Cluster Managers"):
        with Cluster("EKS CM"):
            cms = [EC2Instance("CM"),EC2Instance("CM")]

    console >> skylens
    console >> fe >> cms

Causes the same assertion.

hyakuhei commented 3 years ago

Ensuring lists have three or more items solved the issue temporarily (though that's clearly broken).

Following advice I read on another issue, I tried updating graphviz: brew unlink graphviz brew install graphviz --head

So it looks like this is a graphviz error - closing.

miketheman commented 3 years ago

Confirming.

Looks like it was reported in Graphviz: https://gitlab.com/graphviz/graphviz/-/issues/2082

Version 2.47.3 (unreleased) should contain the fix: https://gitlab.com/graphviz/graphviz/-/blob/main/CHANGELOG.md#fixed